week4_friday - CSCC 69H3 Operating Systems Winter 2010...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCC 69H3 Operating Systems Winter 2010 Professor Bianca Schroeder U of T
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Summary so far … The OS manages resources for processes A process is an instance of a program in execution Includes execution state and resources Processes may contain multiple threads Threads within a process share resources Synchronization is needed to coordinate sharing Deadlock needs to be addressed
Background image of page 2
Next … How does the OS manage processes?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Process Control Block Each process is represented by a process control block (aka process descriptor) Program counter CPU registers CPU scheduling info Memory management info Accounting info I/O status information Program state
Background image of page 4
Linux PCB Called the task_struct in Linux Defined in /include/linux/sched.h TUSVDU UBTL@TUSVDU \ ±²UIFTFBSFIBSEDPEFE³EPO´UUPVDI²± WPMBUJMF MPOH TUBUF± ±²³µVOSVOOBCMF¶·SVOOBCMF¶¸·TUPQQFE²± MPOH DPVOUFS± MPOH QSJPSJUZ± VOTJHOFE MPOH TJHOBM± VOTJHOFE MPOH CMPDLFE± ±²CJUNBQPGNBTLFETJHOBMT²± VOTJHOFE MPOH GMBHT± ±²QFSQSPDFTTGMBHT¶EFGJOFECFMPX²± JOU FSSOP± MPOH EFCVHSFH< ² ±²)BSEXBSFEFCVHHJOHSFHJTUFST²± TUSVDU FYFD@EPNBJO ³FYFD@EPNBJO± ±²WBSJPVTGJFMET²± TUSVDU MJOVY@CJOGNU ³CJOGNU± TUSVDU UBTL@TUSVDU ³OFYU@UBTL´ ³QSFW@UBTL± TUSVDU UBTL@TUSVDU ³OFYU@SVO´ ³QSFW@SVO± VOTJHOFE MPOH TBWFE@LFSOFM@TUBDL± VOTJHOFE MPOH LFSOFM@TUBDL@QBHF± JOU FYJU@DPEF´ FYJU@TJHOBM± |
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
OS/161 PCB Primary OS abstraction is a thread Defined in kern/include/thread.h: struct thread { struct pcb t_pcb; /* process control block */ char *t_name; /* Name of the thread */ const void *t_sleepaddr; /* for waiting/blocking */ char *t_stack; /* private thread stack area */ struct addrspace *t_vmspace; /* user address space */ struct vnode *t_cwd; /* current working directory */ }; Eventually, you will need to add to this structure!
Background image of page 6
OS/161 PCB (continued) Thread struct contains a “struct pcb” Defined in kern/arch/mips/include/pcb.h: struct pcb { u_int32_t pcb_switchstack; // Stack saved during ctxt switch u_int32_t pcb_kstack; // Stack to load on entry to kernel u_int32_t pcb_ininterrupt; // Are we in an interrupt handler pcb_faultfunc pcb_badfaultfunc; // Recovery for fatal //kernel traps jmp_buf pcb_copyjmp; // jump area used by copyin/out etc. }; Machine dependent. You should NOT add to this. Note there is no area for registers in thread or pcb struct! • OS/161 saves registers on thread stack during switch
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Process Control Block Each process is represented by a process control block (aka process descriptor) Program counter CPU registers CPU scheduling info Memory management info Accounting info I/O status information Program state ?
Background image of page 8
Process states The OS manages processes by keeping track of their state Different events cause changes to a process state, which the OS must record/implement New Ready Running Terminated Blocked Admit Dispatch Time-out Event Wait Event Occurs Exit
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
State Queues How does the OS keep track of processes?
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 50

week4_friday - CSCC 69H3 Operating Systems Winter 2010...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online