Download presentation
Presentation is loading. Please wait.
Published byMagnus Burke Modified over 6 years ago
1
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Yan hao (Wilson) Wu University of the Western Cape Computer Science Department
2
Operating system concepts
System calls: processes file system Extended instructions, interface user programs and OS
3
Processes In all OS key, A program in execution! Alive! Active. Static. All the other information needed to run the program Multiprogramming system Suspended->same state All information should be saved during the suspention File 1 pointer-> current position File 2 In Process table (in existence)! Process Creation and termination ! Shell -> run complier Windows has GUI = shell (command interpreters) new created process = Child process -> child process Interprocess communication (IPC). Wait child to terminate Sending message. Timer! Instead of waiting! Alarm interrupt! (alarm signal) current suspend! -> signal handler -> restart! Illegal instruction, using invalid address -> converted to signals UID (user identification) -> each process has the same UID -> child processes. Figure 1-5. A process tree. Process A created two child processes, B and C. Process B created three child processes, D, E, and F.
4
File Systems (1) Hide detail -> present user neat Device-independent files. OS -> system calls for files== create-> read-> write file .(RM) Directory -> grouping file together System call –create rm directories. Tree Process and directory both have hierarchies. But only this! Process not very deep (more than 3 level is unusual) Ownership (files wide, process one owner). Path name to specify the address of the file. ->Root directory. Absolute dir, working dir. Rwxr-x—x. (file and dir) Figure 1-6. A file system for a university department.
5
File Systems (2) File descriptor in OS. Mount. Removable devices. Unrelated floppy. Can not be used. Empty directory. Special file. I/O device look like files. Same system call handle them all. Block special files (disks physically on) Character special files (printer, modems, accept or output character stream data. Keyboard and monitor!!) All special files are in /dev Figure 1-7. (a) Before mounting, the files on drive 0 are not accessible. (b) After mounting, they are part of the file hierarchy.
6
File Systems (3) Figure 1-8. Two processes connected by a pipe.
both relate to files and processes. A process->Output file, Process b<-Input file Figure 1-8. Two processes connected by a pipe.
7
System Calls (1) Process Management
OS is the code that carries out the system calls.!!!!!!!!!!!!!!!!!!! User mode -> need system service -> execute trap -> transfer control -> operating system->kernel mode->result and control->user program. 53 system calls. POSIX. Fork the only way to create new process. Copy himself After fork – separate way. Subsequent changes do not affect one another. The program text is unchangeable which is shared between Child and parent. PID (do different functions) Figure 1-9. The MINIX system calls. fd is a file descriptor; and n is a byte count.
8
Processes Figure Processes have three segments: text, data, and stack. In this example, all three are in one address space, but separate instruction and data space is also supported.
9
System Calls (2) Signals
Hardware detects the traps. Like illegal, floating point, timeout, also implemented as a signal. Sigaction(); Hit the ctrl-c is not the only way to send a signal A process can also send a signal to another one.( unrelated process can not signal each other.) SIGKILL Figure 1-9. The MINIX system calls. fd is a file descriptor; and n is a byte count.
10
System Calls (3) File Management
Fopen, fclose, fwrite, are high level functions that are implemented using file descriptor which definitely are using system calls like open, create, close, read, write.
11
System Calls (4) Dir. & File System Mgmt.
Figure 1-9. The MINIX system calls. fd is a file descriptor; and n is a byte count.
12
System Calls (5) Protection
Figure 1-9. The MINIX system calls. fd is a file descriptor; and n is a byte count.
13
System Calls (6) Time Management
Figure 1-9. The MINIX system calls. fd is a file descriptor; and n is a byte count.
14
The fork Call in the Shell
15
System Calls for File Management (1)
Figure The structure used to return information for the stat and fstat system calls. In the actual code, symbolic names are used for some of the types.
16
System Calls for File Management (2)
Figure A skeleton for setting up a two-process pipeline.
17
System Calls for File Management (3)
Figure A skeleton for setting up a two-process pipeline.
18
System Calls for Directory Management (1)
link(“/usr/jim/memo”,”/usr/ast/note”); Figure (a) Two directories before linking /usr/jim/memo to ast’s directory. (b) The same directories after linking.
19
System Calls for Directory Management (2)
mount(“/dev/cdrom0”,”/mnt”,0); Figure (a) File system before the mount. (b) File system after the mount.
20
pipe
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.