《中山大学软件学院操作系统概念上课教科书的附录a》由会员分享,可在线阅读,更多相关《中山大学软件学院操作系统概念上课教科书的附录a(64页珍藏版)》请在金锄头文库上搜索。
1、Appendix A: UnixBSD,Module A: The FreeBSD System,UNIX History Design Principles Programmer Interface User Interface Process Management Memory Management File System I/O System Interprocess Communication,UNIX History,First developed in 1969 by Ken Thompson and Dennis Ritchie of the Research Group at
2、Bell Laboratories; incorporated features of other operating systems, especially MULTICS The third version was written in C, which was developed at Bell Labs specifically to support UNIX The most influential of the non-Bell Labs and non-AT&T UNIX development groups University of California at Berkele
3、y (Berkeley Software Distributions - BSD) 4BSD UNIX resulted from DARPA funding to develop a standard UNIX system for government use Developed for the VAX, 4.3BSD is one of the most influential versions, and has been ported to many other platforms Several standardization projects seek to consolidate
4、 the variant flavors of UNIX leading to one programming interface to UNIX,History of UNIX Versions,Early Advantages of UNIX,Written in a high-level language Distributed in source form Provided powerful operating-system primitives on an inexpensive platform Small size, modular, clean design,UNIX Desi
5、gn Principles,Designed to be a time-sharing system Has a simple standard user interface (shell) that can be replaced File system with multilevel tree-structured directories Files are supported by the kernel as unstructured sequences of bytes Supports multiple processes; a process can easily create n
6、ew processes High priority given to making system interactive, and providing facilities for program development,Programmer Interface,Kernel: everything below the system-call interface and above the physical hardware Provides file system, CPU scheduling, memory management, and other OS functions thro
7、ugh system calls Systems programs: use the kernel-supported system calls to provide useful functions, such as compilation and file manipulation,Like most computer systems, UNIX consists of two separable parts:,4.4BSD Layer Structure,System Calls,System calls define the programmer interface to UNIX T
8、he set of systems programs commonly available defines the user interface The programmer and user interface define the context that the kernel must support Roughly three categories of system calls in UNIX File manipulation (same system calls also support device manipulation) Process control Informati
9、on manipulation,File Manipulation,A file is a sequence of bytes; the kernel does not impose a structure on files Files are organized in tree-structured directories Directories are files that contain information on how to find other files Path name: identifies a file by specifying a path through the
10、directory structure to the file Absolute path names start at root of file system Relative path names start at the current directory System calls for basic file manipulation: create, open, read, write, close, unlink, trunc,Typical UNIX Directory Structure,Process Control,A process is a program in exe
11、cution. Processes are identified by their process identifier, an integer Process control system calls fork creates a new process execve is used after a fork to replace on of the two processess virtual memory space with a new program exit terminates a process A parent may wait for a child process to
12、terminate; wait provides the process id of a terminated child so that the parent can tell which child terminated wait3 allows the parent to collect performance statistics about the child A zombie process results when the parent of a defunct child process exits before the terminated child.,Illustrati
13、on of Process Control Calls,Process Control (Cont.),Processes communicate via pipes; queues of bytes between two processes that are accessed by a file descriptorAll user processes are descendants of one original process, initinit forks a getty process: initializes terminal line parameters and passes
14、 the users login name to login login sets the numeric user identifier of the process to that of the user executes a shell which forks subprocesses for user commands,Process Control (Cont.),setuid bit sets the effective user identifier of the process to the user identifier of the owner of the file, a
15、nd leaves the real user identifier as it wassetuid scheme allows certain processes to have more than ordinary privileges while still being executable by ordinary users,Signals,Facility for handling exceptional conditions similar to software interruptsThe interrupt signal, SIGINT, is used to stop a c
16、ommand before that command completes (usually produced by C)Signal use has expanded beyond dealing with exceptional events Start and stop subprocesses on demand SIGWINCH informs a process that the window in which output is being displayed has changed size Deliver urgent data from network connections
17、,Process Groups,Set of related processes that cooperate to accomplish a common taskOnly one process group may use a terminal device for I/O at any time The foreground job has the attention of the user on the terminal Background jobs nonattached jobs that perform their function without user interactionAccess to the terminal is controlled by process group signals,