11CMSC 412Fall 2004Operating Systems StructuresAnnouncements• Project #1– Posted. Due Friday.• Reading– Chapter 3, 422Common System Components• Process Management• Main Memory Management• File Management• I/O System Management• Secondary Storage Management• Networking• Protection System• Command-Interpreter SystemProcess Management• A process is a program in execution. Aprocess needs certain resources,including CPU time, memory, files, andI/O devices, to accomplish its task.• The operating system is responsible forthe following activities in connectionwith process management.– Process creation and deletion.– process suspension and resumption.– Provision of mechanisms for:• process synchronization• process communication33Main-Memory Management• Memory is a large array of words orbytes, each with its own address. It isa repository of quickly accessible datashared by the CPU and I/O devices.• Main memory is volatile storage.– It loses its contents on power-loss.• OS memory-related activities:– Track which parts of memory are beingused and by whom.– Decide which processes to load whenmemory space becomes available.– Allocate and deallocate memory space.File Management• A file is a collection of relatedinformation defined by its creator.Commonly, files represent programsand data.• OS file-related activities:– Provide primitives to create, delete, andmanipulate files (and directories).– Map files onto secondary storage.44I/O System Management• The I/O system consists of:– A buffer-caching system– A general device-driver interface– Drivers for specific hardware devicesSecondary-Storage Management• Secondary is storage is a nonvolatilebackup to main memory.• Most modern computer systems usedisks.• Secondary-storage-related OSfunctions:– Free space management– Storage allocation– Disk scheduling55Networking• A distributed system is a collectionprocessors that do not share memoryor a clock, connected through acommunication network.– Communication takes place using aprotocol.• Networking-related OS activities– Managing protocol state– Managing states of distributed resources(e.g. remote filesystem)Protection System• Protection refers to a mechanism forcontrolling access by programs,processes, or users to both system anduser resources.• The protection mechanism must:– distinguish between authorized andunauthorized usage.– specify the controls to be imposed.– provide a means of enforcement.66Command-Interpreter System• Many commands are given to the operatingsystem by control statements which dealwith:– process creation and management– I/O handling– secondary-storage management– main-memory management– file-system access– protection– networkingCommand-Interpreter System• The program that reads and interpretscontrol statements is called variously:– command-line interpreter– shell (in UNIX) Its function is to get and execute thenext command statement.77Operating System Services• Program execution– Load a program into memory and to run it.• I/O operations• File-system manipulation• Communications– Between local or distributed processes– Either shared memory or message passing.• Error detection and recovery– In the CPU and memory hardware, in I/Odevices, or in user programs.Additional OS Functions•Resource allocation•Allocating resources to multiple users ormultiple jobs running at the same time.•Accounting•Keep track of and record which users use howmuch and what kinds of computer resources foraccount billing or for accumulating usagestatistics.•Protection•Controlling all access to system resources.88OS Structure: Simple• Any part of the system may use thefunctionality of the rest of the system– MS-DOS (user programs can call low levelI/O routines)OS Structure: Layered• Layer n can only see the functionalitythat layer n-1 exports– abstracts the lower level details• new hardware can be added if it provides theinterface required of a particular layer– system call interface is an example oflayering99OS Structure: LayeredExample: UNIX1010Example: OS/2OS Structure: Hybrid• Layering has problems on its own– May be difficult to communicateinformation easily– May be inefficient• Hybrid– Use layered, modular approach, butpermit “back doors” to improveinformation flow at the cost of abstraction1111Policy vs. Mechanism• Policy - what to do– users should not be able to read other users files• Mechanism- how to accomplish the goal– file protection properties are checked on opensystem call• Want to be able to change policy withouthaving to change mechanism– change default file protection• Extreme examples of each:– micro-kernel OS - all mechanism, no policy– MacOS - policy and mechanism bound togetherMicrokernel System Structure• Goal: make the kernel as small as possible.• Communication takes place between usermodules using message passing via thekernel.• Benefits:– easier to extend a microkernel– easier to port the OS to new architectures– more reliable and secure (less code running inkernel mode)• Drawback:– More overhead for operation1212Windows NT
View Full Document