Presentation is loading. Please wait.

Presentation is loading. Please wait.

Process Scheduling. Process The activation of a program. Can have multiple processes of a program Entities associated with a process –Instruction pointer,

Similar presentations


Presentation on theme: "Process Scheduling. Process The activation of a program. Can have multiple processes of a program Entities associated with a process –Instruction pointer,"— Presentation transcript:

1 Process Scheduling

2 Process The activation of a program. Can have multiple processes of a program Entities associated with a process –Instruction pointer, SP, other registers –user who owns it –memory location of user data areas –own run-time stack –instructions Different for each process

3 Processes Running Solaris (sun) -> ps -Af linux -> ps –aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 1288 68 ? S Sep21 0:07 init root 2 0.0 0.0 0 0 ? SW Sep21 0:00 [keventd] root 3 0.0 0.0 0 0 ? SW Sep21 0:05 [kapmd] root 4 0.0 0.0 0 0 ? SWN Sep21 0:14 [ksoftirqd_CPU0] root 5 0.0 0.0 0 0 ? SW Sep21 1:06 [kswapd] root 6 0.0 0.0 0 0 ? SW Sep21 0:00 [bdflush] root 7 0.0 0.0 0 0 ? SW Sep21 0:40 [kupdated] root 8 0.0 0.0 0 0 ? SW< Sep21 0:00 [mdrecoveryd] root 12 0.0 0.0 0 0 ? SW Sep21 3:02 [kjournald] root 113 0.0 0.2 1696 196 ? S Sep21 0:00 devfsd /dev root 209 0.0 0.0 0 0 ? SW Sep21 0:00 [khubd] root 335 0.0 0.0 0 0 ? SW Sep21 0:23 [kjournald] root 338 0.0 0.0 0 0 ? SW Sep21 1:22 [kjournald] root 339 0.0 0.0 0 0 ? SW Sep21 5:03 [kjournald] root 1817 0.0 0.0 7424 76 ? S Sep21 0:08 httpd-perl -f /et apache 1821 0.0 0.0 7532 4 ? S Sep21 0:00 httpd-perl -f /et apache 1822 0.0 0.0 7532 4 ? S Sep21 0:00 httpd-perl -f /et apache 1823 0.0 0.0 7532 4 ? S Sep21 0:00 httpd-perl -f /et

4 Process Scheduling Order of process execution is unpredictable Duration of execution is unpredictable OS and/or hardware can support concurrency Whether there is an appearance or real concurrency is not relevant to the designer. There will generally be a need to resynchronize activity between cooperating processes

5 Context switch When OS switches running process, it manipulates internal process tables Loading/storing registers must be done Thread s minimize that effort. Same process, but a different run-time stack. A process within a process. Necessary overhead to manage processes but must balance overhead with advantage of concurrency (real or apparent)

6 What causes context switch? Process runs out of share of CPU time Process blocks –Doing I/O –Waiting on another process to communicate Process terminates

7 Blocking A process needs to do I/O, transfer disk to memory. Another process can use CPU Conflict ->Bus Running process gets the priority Blocked processes use the cpu when free CPU Memory Disk

8 Operating Systems Scheduling Ready 205 198 201 Running 200 Blocked 177 206 180 185 200 blocks when reading from the disk Ready 198 201 Running 205 Blocked 177 206 180 185 200 Ready 198 201 200 Running 205 Blocked 177 206 180 185 200 unblocks when done, ->ready

9 What other activities are important in scheduling? Jobs go from RUNNING to READY when they lose their time slot Jobs go from blocked to READY when the I/O operation they are waiting for completes Jobs go from RUNNING to being removed completely upon exit

10 How does this create concurrency? I/O usage and CPU usage Execute concurrently –CPU is adding –Disk is moving heads and buffering data for transfer across the bus. One of the main efforts of the OS is to manage this concurrency –In addition to lots of others: security, fairness,etc

11 How do you get limited parallelism from the OS? time Process A runs onCPU; blocks on read Disk reads for B while blocked Disk reads for A while A blocked Process C runs for it’s time slice Process B runs cpu disk controller There are times when both processors (CPU and controller) are busy so real parallelism does occur but not at the level of the CPU

12 Concurrency at many levels Process level.. –Scheduling the overlap of CPU and I/O –CAN use concurrency if multiple CPUs AND OS supports Subprocess level (like a procedure)..thread –Mini-context switch same main process Different subprocess Statement level –Typically requires special hardware (arrays of cpus)


Download ppt "Process Scheduling. Process The activation of a program. Can have multiple processes of a program Entities associated with a process –Instruction pointer,"

Similar presentations


Ads by Google