Unit 1
Unit 1
OPERATING SYSTEMS
V.Sravanthi
Asst Prof, CSE
VRSEC
Course Outcomes
CO1 Understand the basic components of an Operating System K2 1.7.1
K4 1.7.1, 2.5.2,
CO4
Apply different page replacement algorithms 2.6.3, 2.6.4,
2.8.4, 3.7.1
2
UNIT I
Introduction: What Operating Systems do
Operating-System Structures: Operating-System Services, User and Operating- System .Interface. System call-Types of Systems calls
Process- Process concepts, Process scheduling
UNIT II
CPU Scheduling: Basic Concepts, Scheduling Criteria, Scheduling Algorithms: FCFS, SJFS,
Priority Scheduling, Round-Robin Scheduling.
Process Synchronization: Background, The Critical-Section Problem, Peterson’s Solution,
Semaphores-Semaphore Usage.
UNIT III:
Deadlocks: System Model, Deadlock Characterization, Methods for Handling Deadlocks Deadlock Prevention, Deadlock Avoidance,
Deadlock Detection-Single Instance of Each Resource Type, Several Instance of Each Resource Type
Main Memory: Background, Contiguous Memory Allocation.
Paging: Basic Method
Swapping: Standard Swapping, Swapping with Paging.
UNIT IV:
Virtual Memory: Background, Demand Paging: Basic Concept, Copy-on-Write. Page Replacement: Basic Page Replacement, FIFO,
Optimal, LRU.
Secondary Storage Structure: Overview of Mass-Storage Structure, Disk Structure.
Disk Scheduling: FCFS, SCAN Scheduling Algorithms.
File-System Implementation: Directory Implementation, Allocation Methods, Free-Space Management
3
UNIT I
6
Operating Systems V.Sravanthi, Asst Prof, CSE, VRSEC
Program execution
The system must be able to load a program into memory and to run that program. The
program must be able to end its execution, either normally or abnormally (indicating error).
O
S
I/O Operations
S
E A running program may require I/O, which may involve a file or an I/O device. For
R efficiency and protection, users usually cannot control I/O devices directly. Therefore, the
V operating system must provide a means to do I/O.
I
C File-System manipulation
E Programs need to read and write files and directories. They also need to create, delete,
S search and list file information. Many operating systems provide a variety of file systems,
sometimes to allow personal choice and sometimes to provide specific features or
performance characteristics. 7
Communications
O Communication may occur between processes that are executing on the same computer or
S between processes that are executing on different computer systems tied together by a
computer network.
S Communications may be implemented via shared memory, in which two or more processes
E
read and write to a shared section of memory, or message passing, in which packets of
R
information in predefined formats are moved between processes by the operating system.
V
I Error Detection
C
E The OS needs to be detecting and correcting errors constantly. Errors may occur in the CPU
S and memory hardware, in I/O devices and in the user program. For each type of error, the
operating system should take the appropriate action to ensure correct and consistent
computing. Sometimes, the OS has to halt the system or terminate an error-causing process or
return an error code.
Operating Systems V.Sravanthi, Asst Prof, CSE, VRSEC 8
Resource Allocation
O When there are multiple users or multiple jobs running at the same time, resources
S must be allocated to each of them.
The operating system manages many different types of resources. Some (such as CPU
S
E cycles, main memory, and file storage) may have special allocation code, whereas
R others (such as I/O devices) may have much more general request and release code.
V
I Accounting
C
A track is to be maintained of which users use how much and what kinds of
E
S computer resources. This record keeping may be used for accounting (so that users
can be billed) or simply for accumulating usage statistics. Usage statistics may be a
valuable tool for researchers who wish to reconfigure the system to improve
computing services.
Operating Systems V.Sravanthi, Asst Prof, CSE, VRSEC 9
Protection and
Security
O The owners of information stored in a multiuser or networked computer system may want to
S control use of that information.
When several separate processes execute concurrently, it should not be possible for one process
S
to interfere with the others or with the operating system itself.
E
R Protection involves ensuring that all access to system resources is controlled. Security of the
V system from outsiders is also important.
I Such security starts with requiring each user to authenticate themselves to the system, usually
C by means of a password, to gain access to system resources.
E
It extends to defending external I/O devices, including network adapters, from invalid access
S
attempts and to recording all such connections for detection of break-ins. If a system is to be
protected and secure, precautions must be instituted throughout it. A chain is only as strong as
its weakest link.
Operating Systems V.Sravanthi, Asst Prof, CSE, VRSEC 10
User Interface (UI)
Almost all operating systems have a user interface (UI), which can take several forms.
1. Command-line interface (CLI): Uses text commands and a method for entering them.
2. Batch interface: commands and directives to control those commands are entered into files,
and those files are executed.
3. Graphical user interface (GUI): It is a window system with a pointing device (like mouse) to
point to the I/O, choose from menus driven interface and to make choices viewing from a
number of lists and a keyboard to entry the texts.
Writing a simple program to read data from one file and copy them to another file.
13
Operating Systems V.Sravanthi, Asst Prof, CSE, VRSEC
Types of System Calls
System calls can be grouped roughly into six major categories:
process control, file manipulation, device manipulation,
information maintenance, communications, and protection.
14
Examples of Windows and Unix System Calls
15
Process Concept
Operating
Systems
V.SRAVANTHI
ASST PROF, CSE
Process Concept
An operating system executes a variety of programs:
– Batch system – jobs
– Time-shared systems – user programs or tasks
Many modern process concepts are still expressed in terms of jobs,
(e.g. job scheduling), and the two terms are often used
interchangeably.
Although two processes may be associated with the same program, they are nevertheless
considered two separate execution sequences.
The PCB is maintained for a process throughout its lifetime, and is deleted once the process
terminates.
Operating Systems V.Sravanthi, Asst Prof, CSE, VRSEC