Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems Lecture # 3. Recap Hardware Operating System Application System Call Trap Hardware Trap Processor.

Similar presentations


Presentation on theme: "Operating Systems Lecture # 3. Recap Hardware Operating System Application System Call Trap Hardware Trap Processor."— Presentation transcript:

1 Operating Systems Lecture # 3

2 Recap Hardware Operating System Application System Call Trap Hardware Trap Processor

3 Time-sharing OS OS emulates that all processes are making simultaneous progress Batch mode does not lie all that well Executes one process to completion, then runs the next one OS is simpler since no pre-emptive context switching Time-sharing OS puts up a better pretence Every process gets a time quantum periodically -- e.g. every 2 msec -- so that everyone makes some progress simultaneously The OS must include support for pre-emptive context- switching

4 Concept of a Task in an Operating System Some way to allocate resources on the hardware for the application Space (memory) Data structures for running computation Some way to execute the application May be more than execution paths in the application code Typically called an “execution thread”

5 What is a process? Stack Code Static Variables Heap Frame1 Frame2 Corresponding to each subroutine Invocation Hello(a, b) --> push frame.. Return; --> pop frame

6 Process Code What is a thread? Stack1 Shared “Heap” Static Variables Stack2 Different PC Different Registers Almost same “memory”

7 Context-switching Capture the state of the running process Freeze it Such that you can re-incarnate it later on Simplest context-switch Subroutine “return” Can implement yourself in user space Called “Cooperative scheduling” or co-routine scheduling

8 Inside the OS When to context-switch When make a system call User to Kernel When make a blocking system call Read from disk or keyboard Process time quantum runs out Pre-emptive scheduling Non-text book detail Scheduling is done when returning from a system call

9 Process States

10 Scheduling FCFS Round-robin Priority


Download ppt "Operating Systems Lecture # 3. Recap Hardware Operating System Application System Call Trap Hardware Trap Processor."

Similar presentations


Ads by Google