================== Start of Lecture 4 ====================== NOTE: These class notes are now on the web http://allan.ultra.nyu.edu/gottlieb/os/class-notes HOMEWORK 3.8 System structure As we said before layering used to raise level of abstraction. Book give examples. MS-DOS and (orig) unix are simple Virtual Machines Give each process the illusion it has an entire machine Supply devices not present (assuming you program at a low level) Ask for a specific device get a virtual one Useful for debugging operating systems New OS runs in virtual supervisor mode Emulate one system on top of another intel on alpha win 3.1 on win 95 System design goals At highest level the goals are vague and like motherhood fast, robust, simple, cheap, correct, convenient, ... At more detailed level get hard tradeoffs Mechanisms and policy how vs what policy: users cannot delete the OS mechanism 1: file permissions mechanism 2: ROM micro-kernel provides (low-level) mechanism higher level processes implement policy HOMEWORK 3.11 Nowadays mostly written in "high-level" languages System Generation Configuration Bootstrap loading ---------- Part II, i.e. the "real course" ------ Chapter 4 Process management Process is an active entity. A program in execution. Terminology not standard (sadly). Will try to use process = task + thread(s) Standard picture with running/ready/waiting (blocked) start / terminate suspended (medium term sched) Process control block PCB Active entity now view as passive data When the process moves from blocked on a device to ready the PCB moves from the corresp device Q to the ready Q. accting/sched/mem info why the process is blocked process state (registers, condition codes, etc) Process switch also called context switch Big time state change. user --> kernel --> user in kernel save state of old process in PCB decide on new process to run this is called process scheduling. really short term scheduling (if on ready Q) Also have med term sched (degree of multiprogramming) Also have long term job scheduling. we will study scheduling policies soon restore state from pcb HOMEWORK 4.1, 4.2 Process Creation We did the unix fork/exec/wait/exit Parent can wait or keep executing (& in shell) VMS has "spawn" (fork+exec): new process is not copy of old Win/NT has both Get a tree of processes Termination What to do if parent terminates before child? Book is wrong about unix. Init inherits the children Process cooperation (coordination) A big topic that is one of my very favorites. Trivial example. Bounded buffer with ONE producer and ONE consumer This is shared memory communication shared in, out, buffer[n] loop -- producer produce an item while (in+1 mod n) = out do nothing; buffer[in] = item; in = in+1 mod n; loop -- consumer while in = out do nothing; item = buffer[out] out = out+1 mod n; consume the item Fails for multiple consumers or producers (in=in+1) Only permits n-1 items in buffer[n]. So useless for n=1 ================== End of Lecture 4 ========================