1 / 12

Process Scheduling

Process Scheduling. 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.

jetta
Download Presentation

Process Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 • Threads 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 Disk Memory

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

  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? disk controller cpu Process A runs onCPU; blocks on read There are times when both processors (CPU and controller) are busy so real parallelism does occur but notat the level of the CPU Disk reads for B while blocked Process C runs for it’s time slice time Disk reads for A while A blocked Process B runs

  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)

More Related