📄 lecture notes for operating systems.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0082)http://www.cs.nyu.edu/~gottlieb/courses/2000-01-spring/os/lectures/lecture-03.html -->
<HTML><HEAD><TITLE>Lecture Notes for Operating Systems</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD>
<BODY>
<P>
<HR>
<STRONG><BIG>
<DIV align=center>================ Start Lecture #3
================</DIV></BIG></STRONG>
<HR>
<P><STRONG>Homework:</STRONG> 6
<H3>1.3.4: The shell</H3>
<P>Assumed knowledge
<P><STRONG>Homework:</STRONG> 9.
<H2>1.4: OS Structure</H2>
<P>I must note that Tanenbaum is a big advocate of the so called microkernel
approach in which as much as possible is moved out of the (supervisor mode)
microkernel into separate processes.
<P>In the early 90s this was popular. Digital Unix (now called True64) and
Windows NT are examples. Digital Unix is based on Mach, a research OS from
Carnegie Mellon university. Lately, the growing popularity of Linux has called
into question the belief that ``all new operating systems will be microkernel
based''.
<H3>1.4.1: Monolithic approach</H3>
<P>The previous picture: one big program
<P>The system switches from user mode to kernel mode during the poof and then
back when the OS does a ``return''.
<P>But of course we can structure the system better, which brings us to.
<H4>1.4.2: Layered Systems</H4>
<P><IMG src="Lecture Notes for Operating Systems.files/layers.png">
<P>
<P>Some systems have more layers and are more strictly structured.
<P>An early layered system was ``THE'' operating system by Dijkstra. The layers
were.
<OL>
<LI>The operator
<LI>User programs
<LI>I/O mgt
<LI>Operator-process communication
<LI>Memory and drum management </LI></OL>
<P>The layering was done by convention, i.e. there was no enforcement by
hardware and the entire OS is linked together as one program. This is true of
many modern OS systems as well (e.g., linux).
<P>The multics system was layered in a more formal manner. The hardware provided
several protection layers and the OS used them. That is, arbitrary code could
not jump to or access data in a more protected layer.
<H3>1.4.3: Virtual machines</H3>
<P><IMG src="Lecture Notes for Operating Systems.files/hypervisor.png"
align=right>
<P>Use a ``hypervisor'' (beyond supervisor, i.e. beyond a normal OS) to switch
between multiple <EM>Operating Systems</EM>
<UL>
<LI>Each App/CMS runs on a <EM>virtual</EM> 370.
<LI>CMS is a <EM>single user</EM> OS.
<LI>A system call in an App traps to the corresponding CMS.
<LI>CMS believes it is running on the machine so issues I/O. instructions but
...
<LI>... I/O instructions in CMS trap to VM/370.
<LI>This idea is still used. A modern version (used to ``produce'' a
multiprocessor from many uniprocessors) is ``Cellular Disco'', <EM>ACM
TOCS</EM>, Aug. 2000. </LI></UL><BR clear=right>
<H3>1.4.4: Client Server</H3>
<P><IMG src="Lecture Notes for Operating Systems.files/client-server.png">
<P>
<P>When implemented on one computer, a client server OS is the microkernel
approach in which the microkernel just supplies interprocess communication and
the main OS functions are provided by a number of separate processes.
<P>This does have advantages. For example an error in the file server cannot
corrupt memory in the process server. This makes errors easier to track down.
<P>But it does mean that when a (real) user process makes a system call there
are more processes switches. These are not free.
<P>A <EM>distributed system</EM> can be thought of as an extension of the client
server concept where the servers are remote.
<P><IMG src="Lecture Notes for Operating Systems.files/dist-client-server.png">
<P>
<P><STRONG>Homework:</STRONG> 11
<H1>Chapter 2: Process Management</H1>
<P>Tanenbaum's chapter title is ``processes''. I prefer process management. The
subject matter is processes, process scheduling, interrupt handling, and IPC
(Interprocess communication--and coordination).
<H2>2.1: Processes</H2>
<P><STRONG>Definition:</STRONG> A <STRONG>process</STRONG> is a program in
execution.
<UL>
<LI>We are assuming a <STRONG>multiprogramming</STRONG> OS that can switch
from one process to another.
<LI>Sometimes this is called <EM>pseudoparallelism</EM> since one has the
illusion of a parallel processor.
<LI>The other possibility is <EM>real parallelism</EM> in which two or more
processes are actually running at once because the computer system is a
parallel processor, i.e., has more than one processor.
<LI>We do not study real parallelism (parallel processing, distributed
systems, multiprocessors, etc) in this course. </LI></UL>
<H3>2.1.1: The Process Model</H3>
<P>Even though in actuality there are many processes running at once, the OS
gives each process the <EM>illusion</EM> that it is running alone.
<UL>
<LI><STRONG>Virtual time</STRONG>: The time used by just this processes.
Virtual time progresses at a rate independent of other processes. Actually,
this is false, the virtual time is typically incremented a little during
systems calls used for process switching; so if there are more other
processors more ``overhead'' virtual time occurs.<BR><BR>
<LI><STRONG>Virtual memory</STRONG>: The memory as viewed by the process. Each
process typically believes it has a contiguous chunk of memory starting at
location zero. Of course this can't be true of all processes (or they would be
using the same memory) and in modern systems it is actually true of no
processes (the memory assigned is not contiguous and does not include location
zero).
<P>Think of the individual modules that are input to the linker. Each numbers
its addresses from zero; the linker eventually translates these relative
addresses into absolute addresses. That is the linker provides to the
assembler a virtual memory in which addresses start at zero. </P></LI></UL>
<P>Virtual time and virtual memory are examples of abstractions provided by the
operating system to the user processes so that the latter ``sees'' a more
pleasant virtual machine than actually exists.
<P><IMG src="Lecture Notes for Operating Systems.files/process-hier.png"
align=right>
<H3>Process Hierarchies</H3>
<P>Modern general purpose operating systems permit a user to create and destroy
processes.
<UL>
<LI>In unix this is done by the <STRONG>fork</STRONG> system call, which
creates a <STRONG>child</STRONG> process, and the <STRONG>exit</STRONG> system
call, which terminates the current process.
<LI>After a fork both parent and child keep running (indeed they have the
<EM>same</EM> program text) and each can fork off other processes.
<LI>A process tree results. The root of the tree is a special process created
by the OS during startup.
<LI>A process can <EM>choose</EM> to wait for children to terminate. For
example, if C issued a wait() system call it would block until G finished.
</LI></UL>
<P>Old or primitive operating system like MS-DOS are not multiprogrammed so when
one process starts another, the first process is <EM>automatically</EM> blocked
and waits until the second is finished. <BR clear=right>
<H3>Process states and transitions</H3>
<P><IMG src="Lecture Notes for Operating Systems.files/process-states.png">
<P>The above diagram contains a great deal of information.
<UL>
<LI>Consider a running process P that issues an I/O request
<UL>
<LI>The process blocks
<LI>At some later point, a disk interrupt occurs and the driver detects that
P's request is satisfied.
<LI>P is unblocked, i.e. is moved from blocked to ready
<LI>At some later time the operating system looks for a ready job to run and
picks P. </LI></UL><BR>
<LI>A preemptive scheduler has the dotted line preempt;<BR>A non-preemptive
scheduler doesn't.<BR><BR>
<LI>The number of processes changes only for two arcs: create and
terminate.<BR><BR>
<LI>Suspend and resume are medium term scheduling
<UL>
<LI>Done on a longer time scale.
<LI>Involves memory management as well.
<LI>Sometimes called two level scheduling. </LI></UL></LI></UL><!-- Local Variables:mode: auto-fillEnd:--></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -