Download presentation
Presentation is loading. Please wait.
1
Processes and Process Table
2
Multitasking Doing more than one task at the same time.
Most people like to multitask, but can only focus on a single task at any instant. CPU can only perform 1 instruction at a time (unless multi-core) but the OS can make it appear to be doing more than one task. Before switching sheets, ask if anybody uses a mobiles while driving. How to they dial (or text) while driving? Go back and forth between the two tasks giving priority to the driving aspect.
3
What is a process? Application that is running on a computer.
Now we start a dialog about what is required. Make somebody the CPU and have 2 or 3 students act as processes (i.e. instruction lists) and have them work together on the CPU with the instructor calling the switch. One of the instruction lists should have a long wait so that we don’t schedule them. This should demonstrate the concept of context switching, will point out that the process has states. We can start building up a state model with the 2 states of running or not running.
4
2 State Process dispatched Ready Running interrupted
Ready means that the process could run but the CPU is already busy. Important to keep in mind that there are other processes. Perhaps a set of cards with the words ready and running could be held up by the students following the direction of the instructor? Introduce the instruction “sleep until” which means that we have no choice but to introduce another state….
5
Process Switching The OS can switch to a new process at any time but the process shouldn’t know about a switch happening. The state of the current process is changed to Ready, the next process is changed to Running. Selecting the next process is called “scheduling” (a later topic).
6
When to Switch Time based When process is finished.
After the process has run for a certain amount of time. OS interrupts the process regardless of what it is doing and changes state to ready. Called “preemptive” switch. When process is finished.
7
3 State Process Model dispatched Ready Running interrupted
event happened wait for event One more step to go… add the beginning and ending states. Blocked
8
Process Switching When the process asks to wait it becomes blocked.
While blocked the OS will never select the process to run.
9
When to Switch Time based When process asks the OS for something.
If process consumes too much CPU time it is changed to ready and another process is allowed to run. OS may not support this!! (Windows 3.1 was an example, but most do now) When process asks the OS for something. Called a non-preemptive switch.
10
Typical State Process Model
dispatched New Ready Running Exit interrupted event happened wait for event Most operating systems keep a table of processes from the time they are created until the time they are finished. When in the table, they need a state… creating a process could take several milliseconds and you do not want the process to start running if it is not completely ready (trust me on this one!). Blocked
11
Process Table Information about all processes currently “active”.
Process ID State Privileged Process Name Priority Register Set File List 45 Ready No iexplorer.exe Medium PC=1000, AX=3421 empty 50 Running word.exe PC=4000, AX=1111 Mylecture.doc 81 Blocked (waiting) Outlook.exe PC=8321, AX=1 720 Yes winlogon.exe High PC=34, AX=-1234
12
What Happens During A Process Switch?
CPU registers are saved. Process state is changed. New process is selected. CPU registers for new process are loaded. New process state is changed. CPU starts executing at new PC.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.