OPERATING SYSTEMS:
DESIGN AND IMPLEMENTATION
- Introduction
- Software has two kinds:
SystemPrograms: Provides interface between Hardware and Software (O/S)
ApplicationPrograms: Performs the actual work the user wants
- Physical devices: integrated circuit chips, wires, power supplies, CRT, etc
- Microprogramming: set of instructions that define machine language. It interprets instructions such as ADD, MOVE, JUMP
Located in ROM
RISC (Reduced Instructions Set Computers) don’t have a microprogramming level “executes the machine language instructions directly”
- Machine Language: has 50 – 300 instructions to perform arithmetic and compare values
I/O devices are controlled by loading values into device registers
- Operating System: Runs in Kernel mode or Supervisor mode “protected from user’s tampering”
Compilers, editors, and command interpreters (shell) are run in user mode
1.1.What is an Operating System?
1.1.1.The O/S as an extended machine
The function of the O/S is to present the user with an extended machine or virtual machine that is easier to program than the underlying hardware.
1.1.2.The O/S as a Resource Manager
Its primary task is to keep track of who is using which resource, to grant resource request, to account for usage, and to mediate conflicting requests from different users. Also sharing information (files, Databases, etc.)
1.2.History of O/S (s)
1.2.1.First Generation (1945 – 1955) Vacuum Tubes
All programming done in absolute machine language
1.2.2.Second Generation (1955 – 1965) Transistors and Batch Systems
Used mostly for scientific and engineering calculations using FORTRAN and Assembly Languages
1.2.3.Third Generation (1965 – 1980) ICs and Multiprogramming
IC Integrated Circuits provided a major price/performance over 2nd generations machines
The code consisted of millions of lines of Assembly language written by thousands of programmers and contained thousands of bugs, which necessitated continuous stream of new releases. With new releases, new bugs were introduced
Multiprogramming: partitioning the memory with a different job in each partition.Special hardware protects each job against other jobs running in memory at once
Spooling “Simultaneous Peripheral Operation On Line”: whenever a running job finished, O/S load a new job from disk to the now-empty partition and run it
Timesharing: each user has an on-line terminal where CPU times is dedicated only to the jobs that need service “MULTICS”
1.2.4.Fourth Generation (1980 – Present) PC (s)
The LSI (Large Scale Integration) circuits helped introduce the PCs
1.2.5.UNIX “Network Servers”
1.3.Operating System Concepts
1.3.1.Process: a program in execution. Associated with each process:
Address Space: memory locations from 0 – maximum, which the process can read and write. It contains: the executable program, the program’s data, and its stack
Set of registers, including the program counter, stack pointer, and H/W registers
Process Table: An array of structures, one for each currently in existence that contains all the information about the process
Core Image: a suspended process that contains its address spaces and its process table
Command Interpreter “Shell”: reads a command from a terminal that forces the shell to create a process for it. When it is finished, it executes a system call to terminate itself
Child Processes: when a process creates one or more other processes, and these processes in turn create child processes
Interprocess Communication: related processes that are cooperating must communicate synchronize their activities
Signal: A signal causes a process to temporarily suspend whatever its doing by saving its registers on the stack and start running a special signal handling procedure to retransmit a presumably lost message “traps detected by hardware” “executing illegal instructions”
1.3.2.Files:“is a file (sequence of Bytes – Record = byte)”
Directory: a way of grouping files together
Path Name: a file can be specifiedfrom the top of the directory hierarchy “root directory” by giving its path name /Students/Leo
The Unix O/S File System:
- Everything is a file (a sequence of bytes; record = byte)
- Directories: Multilevel (implemented as files). Contain pairs: filename, i-node address)
- Directory commands: chdir “cd”, mkdir, rmdir, pwd.
- File commands: rm, mv, cp, cat, ls,
- Several links to a file shared file.
- Protection:
- A permission change has 3 parts:
Relative method
- u for file’s owner, g for the file’s group, o for others “UNIX public”, a for everyone
- Adding, deleting or setting exact permissions, +, -, = respectively
- = Clears the selected permission field and sets it to the code specified. If you do not specify a permission code following =, chmod removes all permissions from the selected field
- r read, w write, and e execute
Symbolic method
- 4 read, 2 write, and 1 execute
Ex:
$ ls –l saints: show file’s properties with a long list
ownergroupeveryone
d rwerwerwe# linksownersize BDate modname
- rw-r--r--1Jason2045Jan 15 1:00saints
chmod a+r *.html gives all files read permission that end with html type at all levels
chmod 444 *.html
chmod uog-w saints removes the write permission on the saints file for everyone
chmod uog=r saints lets everyone have read permission on the file saints
chmod 444 saints
Pipe: a Pseudofile that can be used to connect two processes
1.3.3.The Shell: A program that serves as an interface between the user and UNIX kernel. Several shells are available: Bourne shell (sh), C shell (csh), and Korn shell (ksh).
Their prompt signs are usually: $, %, # respectively
1.4.Operating System Structure:
1.4.1.Monolithic System: “The Big Mess”
A main program that invokes the requested service procedure
A set of service procedures that carry out the system calls
A set of utility procedures that helps the service procedures
1.4.2.Layered Systems:
1.4.3.Virtual Machines:
1.4.4.Client Server Model: