Professional Documents
Culture Documents
CH 10 UNIX
CH 10 UNIX
CH 10 UNIX
History of unix Overview of unix Processes in unix Memory management in unix Input/output in unix The unix file system Security in unix
Note: This case study covers only UNIX. Please read chapter 10 of the text book for LINUX.
Ceng 334 - Operating Systems
10-1
History of UNIX
Originated from the MULTICS (Multiplexed Information and Computing Service) operating system by M.I.T, Bell Labs and GE There are two main versions: AT&T System V Release 4 (SVR4) Originally developed by AT&T, now SCO BSD (Berkeley Software Distribution)
Ceng 334 - Operating Systems
10-2
Overview of UNIX
Supports various architectures Structure varies Supports preemptive multitasking Multiuser environment - generally secure Supports multithreaded applications Protection/Security is high on modern versions Supports symmetric multiprocessing Highly scalable/portable to various systems Many types/flavours of UNIX exist
10-3
UNIX Layers
User Interface
10-4
10-7
10-8
POSIX Shell
The ls Command
Pipes - syncronized channels between processes to pass byte streams Signals software interrupts used for interprocess communication. Choices: catch, ignore, or kill process
Ceng 334 - Operating Systems
10-11
10-12
s is an error code pid is a process ID residual is the remaining time from the previous alarm
Ceng 334 - Operating Systems
10-13
10-14
10-16
The UNIX scheduler is based on a multilevel queue structure (highest priority queue first, round-robin in each queue) In this scheme, a process which was blocked and waiting for an event joins the appropriate queue when blocking is over (a process whose disk I/O is finished joins,say, queue 4)
Ceng 334 - Operating Systems
10-18
cp
Handling Memory
Process A Process B
Each process has three segments (shown as one segment in the figure, but if hardware supports they can be separate): Text : executable code (which is shared in the figure) Data : variables, strings, arrays etc.
initialized data variables which must be initialized to some value when program starts Uninitialized data (BSS) not initialized but has value 0 as default
Stack Text is fixed in length, data and stack can grow and shrink
Ceng 334 - Operating Systems
10-22
10-23
Main memory: kernel, core map, pages Core map has an entry for each page and contains information about the contents of the page frames
Ceng 334 - Operating Systems
10-24
The pointer (hand) points to the oldest page When a page fault occurs,
if the R bit of the pointed page is 0 (page not referred), this page is evicted (the new page replaces this page - written to disk first if it is dirty) if the R bit is 1 (page accessed), R bit is cleared and the hand is advanced to the next page
Ceng 334 - Operating Systems
10-26
I/O in UNIX
All I/O devices are integrated into the file system as special files These special files are accessed like ordinary files (ie., file operations such as read, write, open are the same for special files
10-28
10-31
C-list
10-33
s is an error code (-1 if an error has occured) fd is a file descriptor (a positive number: 0 standard input) position is a file offset
Ceng 334 - Operating Systems
10-39
Disk layout in classical UNIX systems Block 0 is the boot block Block 1 is the superblock which contains information about the layout of the file system, including the number of i-nodes, number of disk blocks, and start of the list of free disk blocks
Ceng 334 - Operating Systems
10-42
File descriptor table is indexed by the fd parameter and has one entry for each file
The relation between the file descriptor table, the open file description
Ceng 334 - Operating Systems
10-44
A BSD directory with three files.The same directory after the file voluminous has been removed File name can be 255 characters long The first 4 fields are fixed length
Ceng 334 - Operating Systems
10-45
s is an error code uid and gid are the UID and GID, respectively
Ceng 334 - Operating Systems
10-48