What is an operating system?
Download
Report
Transcript What is an operating system?
What is an operating system?
• Tool to make programmer's job easy
• Resource allocator
– Must be fair; not partial to any process
– Must discriminate between different class of jobswith different service
requirements
– Do the above efficiently
• Control program
• Tool to facilitate efficient operation of computer system
• Virtual machine that is easier to understand and program
• Layered architecture
History of the operating systems
Early/First Generation Systems
• 1945 -- 1955
• Bare machines -- vaccum tubes and plugboards
•
•
•
– Exemplified by ENIAC
– Electronic Numerical Integrator And Computer
– Designed by J.W.Mauchly and J.P.Eckertof the University of
Pennsylvania in 1945
– Commissioned by the Ballistics Research Lab (BRL) at the Aberdeen
Proving Ground in Maryland
– Made up of 18,000 vaccum tubes and 1,500 relays
No operating system
Black box concept -- human operators
No protection
Second Generation Systems
• 1956 -- 1965
• Transistors and batch systems
• Clear distinction between designers, builders, operators,
programmers, and maintenance personnel
• I/O channel
• Read ahead / spooling
• Interrupts / exceptions
• Minimal protection
• Libraries / JCL
Third Generation Systems
• 1965 -- 1980
• ICs and Multiprogramming
• System 360 and S/370 family of computers
• Spooling (simultaneous peripheral operation on-line)
• Time sharing
• On-line storage for
–
–
–
System programs
User programs and data
Program libraries
Third Generation Systems
• Virtual memory
• Multiprocessor configurations
• MULTICS
Fourth Generation and Beyond
• Personal computers and workstations
• MS-DOS and Unix
• Massively parallel systems
–
–
–
–
Pipelining
Array processing / SIMD
General multiprocessing / MIMD
Symmetric multiprocessing / SMD
Any process and any thread can run on any available processor
Fourth Generation and Beyond
• Computer networks (communication aspect) -- network operating
systems
• Distributed computing -- distributed operating systems
Operating System Concepts
•
•
•
•
•
•
Kernel
Processes
Threads
Files
System calls
Shell
Processes in Operating Systems
• A program in execution
• May be stopped and later restarted by the OS
• Process table
–
–
–
–
–
•
Records information about each process
Program code
Data
Stack
Program counter (PC), Stack pointer (SP), and other registers
Core image
Processes in Operating Systems
• Process has a parent [process] and may create child processes
• Communication through messages
• Process ownership determined by the UID and GID
• Process id identifies the process
• Special process id's in Unix
–
–
–
0 Swapper
1 /sbin/init
2 Pagedaemon
Process execution modes in Unix
• Two modes of process execution: user mode and kernel mode
• Normally, a process executes in the user mode. When a process
executes a system call, the mode of execution changes from user
mode to kernel mode. The bookkeeping operations related to the
user process (interrupt handling, process scheduling, memory
management) are performed in kernel mode.
Process execution modes in Unix
• User mode
Processes can access their own instructions and data but not kernel
instructions and data
Cannot execute certain privileged machine instructions
• Kernel mode
Processes can access both kernel as well as user instructions and
data
No limit to which instructions can be executed
Runs on behalf of a user process and is a part of the user process
Process execution modes in Unix
• Threads
A dispatchable unit of work to provide intraprocess concurrency in
newer operating systems
A process may have multiple threads of execution in parallel, each
thread executing sequentially
Files and File Management
• File management system provides services to hide the specifics of
tape and disk
• Invoked by system calls
• Files are grouped together by a directory
Organized as a hierarchical tree
Root directory
Files specified by path name
Path name separator (/ in Unix, \ in DOS)
Working directory
Files and File Management
• Protection of files
Based on a 9-bit code in Unix -- rwx bits
• File descriptor or handle
A small integer to identify a file in subsequent operations
A denial of access indicated by an error code
0 Standard input
1 Standard output
2 Standard error
Files and File Management
• I/O devices treated as special files
b Block special files
c Character special files
• Pipes
A pseudo file to connect two processes
• Unix file system
Unix File System
Characterized by
• Hierarchical structure
• Consistent treatment of file data
• Ability to create and delete files
• Dynamic growth of files
• Protection of file data
• Treatment of peripheral devices as files
Unix File System
Organized as a tree
• Single root node
• Non-leaf nodes
Directories
•
Leaf nodes
–
–
Regular files
Special device files \
• Path name
• Specifies how to locate the file in the system hierarchy
Multiprogramming
• CPU-bound system
• I/O-bound system
• Maintain more than one program in the main memory
• Sharing of time and space
Multiprogramming OS
• Requires addition of new hardware components
–
–
–
–
–
•
•
•
•
DMA Hardware
Priority Interrupt Mechanism
Timer
Storage and Instruction Protection
Dynamic Address Relocation
Is more complex compared to a simple OS
Must hide the sharing of resources between different users
Must hide details of storage and I/O devices
Requires a complex file system for secondary storage
Tasks of a multiprogramming OS
•
•
•
•
Bridge the gap between the machine and the user level
Manage the available resources needed by different users
Enforce protection policies
Provide facilities for synchronization and communication
Shell
• Command interpreter in Unix
•
Interprets the first word of a command line as a command
name
• Is a user program and not a part of the kernel
• Provides a prompt
• Allows for redirection of input and output
• Provides capability to run jobs in the background
•
Shell
• For most commands, the shell forks and the child execs the
command associated with the name, treating the
• remaining words on the command line as parameters to the
command
• Allows for three type of commands
•
1.Executable files
•
2.Shellscripts
•
3.Built-in shell commands
System Calls
• Set of extended instructions provided by the operating system
• System calls provide an interface between user program and
operating system
• Applied to various software objects like processes and files
• Invoked by user programs to communicate with the kernel and
request services
• Return from trap instruction
System Calls
• Library procedure corresponding to each system call
– Machine registers to hold parameters of system call
– Trap instruction (protected procedure call) to start OS
– Hide details of trap and make system call look like ordinary procedure
call
• Example
count = read ( file, buffer, nbytes );
•
Actual system call read invoked by read
•
Number of bytes actually read is returned in count
•
In case of error, count is set to -1 \
Multics
• Multiplexed Information and Computing Service
• Design started in 1965 and completed in 1972
• Collaborative effort between General Electric, Bell Telephone Labs,
and Project MAC of MIT
• Aimed at providing
– Simultaneous computer access to large community of users
– Ample computation power and data storage
– Easy data sharing between users, if desired