Integrated set of programs that controls the resources (the CPU, memory, I/O devices, etc.) of a computer system
Operating system
Provides its users with an interface or virtual machine that is more convenient to use than the bare machine
Two primary objectives are: making a computer system convenient to use and managing the resources of a computer system
The operating system layer hides the details of the hardware from the programmer and provides the programmer with convenient interface for using the system
Main functions of an operating system
Process management
Memory management
File management
Security
Command interpretation
Throughput
Amount of work that the system is able to do per unit time
Turnaround time
Interval from the time of submission of a job to the system for processing to the time of completion of the job
Response time
Interval from the time of submission of a job to the system for processing to the time the first response for the job is produced by the system
Process
A program in execution
Process management
Manages the processes submitted to a system in a manner to minimize idle time of processors (CPUs, I/O processors, etc.) of the system
Manual loading mechanism
Jobs were manually loaded one after another in a computer by the computer operator
Batch processing mechanism
Batch of jobs was submitted together to the computer and job-to-job transition was done automatically by the operating system
Job Control Language (JCL)
Control statements were used to facilitate job loading and unloading
Uniprogramming
Only one job is processed at a time and all system resources are available exclusively for the job until its completion
Multiprogramming
Interleaved execution of two or more different and independent programs by a computer
Types of Multiprogramming
Multiprogramming with fixed tasks (MFT): Fixed number of jobs can be processed concurrently
Multiprogramming with variable tasks (MVT): Number of jobs can vary
Memory partition
Area occupied by each job residing simultaneously in the main memory
Types of jobs
CPU bound: Mostly perform computations with little I/O operations
I/O bound: Mostly perform I/O operations with little computation
Uniprogramming system
Only one job is processed by the system at a time and all the system resources are exclusively available for the job until it completes
Multiprogramming system
Interleaved execution of multiple jobs (often referred to as tasks of same user) in a single-user system
Computer systems used for multitasking are uniprocessor systems (having only one CPU)
Treated differently from multiprogramming that refers to interleaved execution of multiple jobs in a multi-user system
Thread
Basic unit of CPU utilization. Threads share a CPU in the same way as processes do
Multithreading
All threads of a process also share the same set of operating system resources
All threads of a process inherit parent's address space and security parameters
Each thread of a process has its own program counter, its own register states, and its own stack
Tightly-coupled multiprocessing
Single system-wide primary memory shared by all processors
Loosely-coupled multiprocessing
Each processor has its own local memory
Multiprocessing is a system with two or more CPUs having ability to execute multiple processes concurrently
Simultaneous interactive use of a computer system by many users is called multiuser
Time-sharing
Simultaneous interactive use of a computer system by many users in such a way that each one feels that he/she is the sole user of the system
Advantages of Time-sharing Systems
Reduces CPU idle time
Provides advantages of quick response time
Offers good computing facility to small users
Memory Management
Keeps track of parts of memory in use and parts not in use
Allocates memory to processes as needed and deallocates when no longer needed
Uniprogramming Memory Model
Used in systems that process one job only at a time, and all system resources are available exclusively for the job until it completes
Multiprogramming with Fixed Number of Memory Partition
User area of the memory is divided into a number of fixed-sized partitions
Multiprogramming with Variable Number of Memory Partitions
Number, size and location of the partitions vary dynamically as processes come and go
Virtual Memory
Memory management scheme that allows execution of processes that might not be completely loaded in the main memory
Virtual Memory Realization
1. On-line secondary storage
2. Swapping
3. Demand paging
Advantages of Virtual Memory
Provides a large virtual memory to programmers on a system having smaller physical memory
Enables execution of a process on a system whose main memory size is less than the total memory required by the process
Enables a process's execution to be started even when sufficient free memory for loading the entire process is not available
Makes programming easier there no longer need to worry about the memory size limitations
Often leads to less I/O activity resulting in better throughput, turnaround time, and response time
Disadvantages of Virtual Memory
Difficult to implement because it requires algorithms to support demand paging
If used carelessly, it may substantially decrease performance due to high page fault rate
File Management
File's name uniquely identifies it in the system and is used by its users to access it
File's data is its contents
File's attributes contain information such as date & time of its creation, date & time of last access, date & time of last update, its current size, its protection features, etc.
File Access Methods
Sequential access: Information stored in a file can be accessed sequentially (in the order in which they are stored, starting at the beginning)
Random access: Information stored in a file can be accessed randomly irrespective of the order in which the bytes or records are stored
External security
Deals with securing computer against external factors such as fires, floods, earthquakes, stolen disks/tapes, etc. by maintaining adequate backup, using security guards, allowing access to sensitive information to only trusted employees/users
Internal security
Deals with user authentication, access control, and cryptography mechanisms
User authentication
Deals with the problem of verifying the identity of a user (person or program) before permitting access to the requested resource