Plan

Operating Systems ó Administration ó Multitasking  Single task Lesson 3  Cooperative multitasking  Preemptive multitasking ó Windows  Processes  teaser ó Beeper Sample ó Q&A on Assignment #1

Multitasking: Singe-task system Cooperative Multitasking

ó DOS ó Windows 3.11 ó Running program gets full control over ó Program may voluntary give up CPU time computer resources for other programs(e.g. waiting for ó Next program(task) couldn’t start before printing job to finish) previous ended ó User may select/activate program to run ó Not efficient (CPU is idle while program (pause editor and look into spreadsheet is printing or waits for keyboard input ó How a program know when to CPU to other program and when (if ever) will get it back?

Multitasking: Some Windows: Preemptive multitasking Requirements ó Programmer shouldn’t write a program ó OS decides when to run each task and aware of other programs. for how long ó Each task gets fare share of CPU time ó In order to switch between programs (tasks) one should be able to freeze the state of the according to task priority paused program (e.g. current instruction, ó Windows manages each task states and register and memory state) and resume its guard its private memory and manage afterwards shared resources (disk) ó Task may enter “waitable/ state” ó Task shouldn’t have access to private memory of other tasks (e.g. wait for other task to complete) so OS won’t allocate any CPU time at all Windows: Task== Process properties

ó Identifier ó A Windows object (has a handle)  0x0034FE12 ó An instance of a program running on a ó State  Running, waiting etc computer ó Priority  Low, high ó Two opened notepads are two processes ó ó Several Internet Explorer windows may  Address in memory of next instruction to execute ó Memory pointers be supported by single process  Location of process memory in RAM ó Context data  Registers ó Accounting information  CPU time used till now

Memory Management

ó How does a programmer know how much free memory is available for his program?

ó He shouldn’t care. The OS provides management for all processes.

ó Details: Next class