0% found this document useful (0 votes)
410 views115 pages

Os Notes PDF

The document discusses operating system concepts across 6 units: Unit 1 introduces operating systems and their objectives like process scheduling and memory management. Units 2-4 cover key OS components - processes and memory management, including paging and virtual memory. It also discusses deadlocks. Unit 5 discusses file management, including file structures, directories and security. Units 6 provides case studies of UNIX, Linux and mobile operating systems to demonstrate concepts in practice. It examines the shell, kernel and memory management techniques in UNIX and Linux.

Uploaded by

Vishnu Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
410 views115 pages

Os Notes PDF

The document discusses operating system concepts across 6 units: Unit 1 introduces operating systems and their objectives like process scheduling and memory management. Units 2-4 cover key OS components - processes and memory management, including paging and virtual memory. It also discusses deadlocks. Unit 5 discusses file management, including file structures, directories and security. Units 6 provides case studies of UNIX, Linux and mobile operating systems to demonstrate concepts in practice. It examines the shell, kernel and memory management techniques in UNIX and Linux.

Uploaded by

Vishnu Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 115

Operating System

UNIT -1

Introduction:Objective, scope and outcome of the course.


Objective of the subject:
1)To understand basic knowledge of operating system, processes ,interprocess
communication & their scheduling.

2) To understand how memory is being managed for different processes.

3) To understand how deadlock is occurred among processes & how it can be


eliminated.

4) To understand how files are being managed by OS.

5)To gain knowledge of LINUX,UNIX& MOBILE OS.

Scope of the subject:


Course outcome:
UNIT -2

Introduction and History of Operating systems: Structure and operations;


processes and files Processor management: inter process communication,
mutual exclusion, semaphores, wait and signal procedures, process scheduling
and algorithms, critical sections, threads, multithreading

UNIT -3

Memory management: contiguous memory allocation, virtual memory,


paging, page table structure, demand paging, page replacement policies,
thrashing, segmentation, case study

UNIT -4
Deadlock: Shared resources, resource allocation and scheduling, resource
graph models, deadlock detection, deadlock avoidance, deadlock prevention
algorithms Device management: devices and their characteristics, device
drivers, device handling, disk scheduling algorithms and policies

Device management:

Device management in operating system implies the management of the I/O


devices such as a keyboard, magnetic tape, disk, printer, microphone, USB ports,
scanner, camcorder etc.as well as the supporting units like control channels. The
basics of I/O devices can fall into 3 categories:

Block device: it stores information in fixed-size block, each one with its own
address.exampledisk.
Character device: delivers or accepts a stream of characters. The individual
characters are not addressable. For example printers, keyboards etc.
Network device: For transmitting data packets.

For device management in operating system:

• Keep tracks of all devices and the program which is responsible to perform
this is called I/O controller.

• Monitoring the status of each device such as storage drivers, printers and
other peripheral devices.

• Enforcing preset policies and taking a decision which process gets the device
when and for how long.

• Allocates and Deallocates the device in an efficient way.De-allocating them


at two levels: at the process level when I/O command has been executed and
the device is temporarily released, and at the job level, when the job is
finished and the device is permanently released.

• Optimizes the performance of individual devices.

TYPES OF DEVICES
The OS peripheral devices can be categorized into 3: Dedicated, Shared, and
Virtual. The differences among them are the functions of the characteristics of the
devices as well as how they are managed by the Device Manager.

Dedicated devices:-

Such type of devices in the device management in operating system are


dedicated or assigned to only one job at a time until that job releases them. Devices
like printers, tape drivers, plotters etc. demand such allocation scheme since it
would be awkward if several users share them at the same point of time. The
disadvantages of such kind f devices s the inefficiency resulting from the allocation
of the device to a single user for the entire duration of job execution even though
the device is not put to use 100% of the time.

Shared devices:-

These devices can be allocated o several processes. Disk-DASD can be shared


among several processes at the same time by interleaving their requests. The
interleaving is carefully controlled by the Device Manager and all issues must be
resolved on the basis of predetermined policies.

Virtual Devices:-

These devices are the combination of the first two types and they are dedicated
devices which are transformed into shared devices. For example, a printer
converted into a shareable device via spooling program which re-routes all the
print requests to a disk. A print job is not sent straight to the printer, instead, it goes
to the disk(spool)until it is fully prepared with all the necessary sequences and
formatting, then it goes to the printers. This technique can transform one printer
into several virtual printers which leads to better performance and use.

Ways to access a device in device management in operating system

Polling:-

In this, a CPU continuously checks the device status for exchanging data. The plus
point is that it is simple and the negative point is – Busy-waiting.

Interrupt-driven I/Os:-
A device controller notifies the corresponding device driver about the availability
of the device. The advantages can be a more efficient use of CPU cycles and the
drawbacks can be data copying and movements and slow for character devices-one
interrupt per keyboard input.

Note:-

A device driver is an operating system component which is responsible for the


hiding f complexity of an I/O device so that the OS can access various devices in a
uniform manner.

A device controller performs conversion between serial bit stream and a block of
bytes, do error correction if necessary and has 2 main components; a device
registers to communicate with the CPU and a Data buffer that an OS can read or
write.

Direct memory access (DMA):-

To perform data movements additional controller bought into use. The benefit of
such a method is that CPU is not involved in copying data but a con is that a
process cannot access in-transit data.

Double buffering:

This methodology access advice makes use of two buffers so that while one is
being used, the other is being filled. Such a way is quite popular in graphics and
animation so that the viewer does not see the line-by-line scanning.

UNIT -5

File management: file concept, types and structures, directory structure, cases
studies, access methods and matrices, file security, user authentication

UNIT -6

UNIX and Linux operating systems as case studies; Time OS and case studies
of Mobile OS

UNIX operating systems case study


The Shell
• The shell is the interface between the command language user and the OS
• The shell is a user interface and comes in many forms (Bourne Shell, sh;
Berkeley C Shell, csh; Korn Shell, ksh; Restricted Shell, rsh)
• User allowed to enter input when prompted ($ or %)
• System supports all shells running concurrently. Appropriate shell is loaded
at login, but user can usually (except in sh, rsh) dynamically change the
shell.
• The shell runs a command interpretation loop
o accept command
o read command
o process command
o execute command
• Executing the command involves creating a child process running in another
shell (an environment within which the process can run). This is done
by Forking.
• The parent process usually waits for the child to terminate before re-entering
the command interpretation loop
• Programs can be run in the background by suffixing the command-line entry
with an ampersand (&). Parent will not wait for child to terminate

The Kernel

• Central part of the OS which provides system services to application programs


and the shell
• The kernel manages processes, memory, I/O and the Timer - so this is not the
same as the kernel that we covered in Lecture 3!
• UNIX supports multiprogramming
• Processes have their own address space - for protection
• Each process's process environment is composed of an unmodifiable re-
entrant text (code) region, a modifiable data region and a stack region.
• The text region is shareable
• Processes can modify their environment only through calls to the OS.

Memory Management

Address Mapping (Virtual Storage) - Paged MMS


Paging

• SunOS maintains 2 data structures to control paging


• The free list contains empty page frames
• The loop contains an ordered list of all allocated page frames (except for the
kernel)
• The pager ensures that there is always free space in memory
• When a page is swapped out (not necessarily replaced) the system judges
whether the page is likely to be used again
• If the page contains a text region, the page is added to the bottom of the free
list, otherwise it is added to the top
• When a page fault occurs, if the page is still in the free list it is reclaimed
• The replacement strategy replaces the page that has not been active for longest
(LRU)

Linux operating systems case study

The architecture of a Linux System consists of the following layers –

• Hardware layer − Hardware consists of all peripheral devices (RAM/ HDD/ CPU

• Kernel − It is the core component of Operating System, interacts directly with


hardware, provides low level services to upper layer components.

• Shell − An interface to kernel, hiding complexity of kernel's functions from


users. The shell takes commands from the user and executes kernel's functions.

• Utilities − Utility programs that provide the user most of the functionalities of an
operating systems.
Memory management is one of the most complex activity done by Linux kernel. It has various
concepts/issues associated with it.

• The memory management subsystem is one of the most important parts of the operating system. Since
the early days of computing, there has been a need for more memory than exists physically in a system.
Strategies have been developed to overcome this limitation and the most successful of these is virtual
memory. Virtual memory makes the system appear to have more memory than it actually has by sharing it
between competing processes as they need it.

• Virtual memory does more than just make your computer's memory go further. The memory
management subsystem provides:

Protection:- Each process in the system has its own virtual address space. These virtual address
spaces are completely separate from each other and so a process running one application cannot affect
another. Also, the hardware virtual memory mechanisms allow areas of memory to be protected against
writing. This protects code and data from being overwritten by rogue applications.

Memory Mapping:- Memory mapping is used to map image and data files into a processes
address space. In memory mapping, the contents of a file are linked directly into the virtual address space
of a process.
Some commands in linux

Scheduling in Linux
1. Real-time FIFO. 2. Real-time round robin. 3. Timesharing.
Difference between UNIX AND LINUX
Difference between WINDOWS AND LINUX
BASIS FOR COMPARISON LINUX WINDOWS

Cost Free of cost Expensive

Open source Yes No

Customizable Yes No

Security More secure Vulnerable to viruses and malware

attacks.

Booting Either primary or logical partition. Only primary partition.

Separation of the directories using Forward slash Back slash

File names Case sensitive Case insensitive

File system EXT2, EXT3, EXT4, Reisers FS, XFS FAT, FAT32, NTFS and ReFS

and JFS

Type of kernel used Monolithic kernel Microkernel

Efficiency Effective running efficiency Lower than Linux

TIME OS CASE STUDY

Definition
A real-time operating system (RTOS) is an operating system (OS) intended to
serve real-time applications that process data as it comes in, typically without
buffer delays. Processing time requirements (including any OS delay) are
measured in tenths of seconds or shorter increments of time. A real-time system is
a time bound system which has well defined fixed time constraints. Processing
must be done within the defined constraints or the system will fail. They either
are event driven or time sharing. Event driven systems switch between tasks based
on their priorities while time sharing systems switch the task based on clock
interrupts.

The primary functions of the real time operating system are to:

1. Manage the processor and other system resources to meet the requirements of an
application.

2. Synchronize with and respond to the system events.

3. Move the data efficiently among processes and to perform coordination among
these processes.
Examples of real time processing are:
1. Airlines reservation system.
2. Air traffic control system.
3. Systems that provide immediate updating.
4. Systems that provide up to the minute information on stock prices.
5. Defense application systems like as RADAR.
Scheduling Algorithms

Some commonly used RTOS scheduling algorithms are:

• Cooperative scheduling

• Preemptive scheduling

• Earliest Deadline First approach

Memory management
Memory management is one of the most important subsystems of any operating
system for computer control systems, and is even more critical in a RTOS than in
standard operating systems. Firstly, the speed of memory allocation is important in
a RTOS. A standard memory allocation scheme scans a linked list of indeterminate
length to find a free memory block; however, memory allocation has to occur in a
fixed time in a RTOS. Secondly, memory can become fragmented as free regions
become separated by regions that are in use, causing a program to stall, unable to
get memory, even though there is theoretically enough available. Memory
allocation algorithms that slowly accumulate fragmentation may work perfectly
well for desktop machines rebooted every day or so but are unacceptable for
embedded systems that often run for months without rebooting.

Mobile OS case study

Much like the Linux or Windows operating system controls your desktop or laptop
computer, a mobile operating system is the software platform on top of which
other programs can run on mobile devices. The operating system is responsible for
determining the functions and features available on your device, such as thumb
wheel, keyboards, WAP, synchronization with applications, email, text
messaging and more. The mobile OS will also determine which third-party
applications (mobile apps) can be used on your device.
Feature Android iOS Windows 10 Mobile BlackBerry 10
Google, Open Handset
Developed by Apple Inc. Microsoft BlackBerry Ltd.
Alliance

Market share[3] 86.1% 13.7% Unknown Unknown

Current version 10 13.0 10.0.15254.552 10.3.3.3216

Development 13.1 Developer


Android 10 Unknown Unknown
version Beta 4

Current version September 3, 2019; 51 September 19, February 12, 2019; 8


April 4, 2018; 18 months ago
release dates days ago 2019; 35 days ago months ago[4][5][6]

Base system is Free


and open-source, but
usually bundled with Proprietary except for
Proprietary, Commercial
License proprietary apps and Proprietary open source
software
drivers, which provide components
an increasing amount of
the functionality.[11]

OS family Linux kernel based Darwin Microsoft Windows QNX

ARM (32-bit ARMv7-A


Supported CPU 64-bit ARMv8-A 32-bit ARMv7-A and
and 64-bit ARMv8-A ARM
architecture only 32-bit ARMv8-A
only), x86, x86-64[13]

7+: XNA (.NET


C#), Silverlight, native C/ C++: Native SDK,
C/C++ (only for vendors C++/Qt: Cascades SDK,
C, C++, Objective- and partners[14]) HTML5/Javascript/CSS:
Programmed in C, C++, Java, Kotlin
C, Swift 8+: .NET C#, Webworks SDK,
VB.NET, Silverlight, ActionScript: Adobe AIR,
native C/C++, WinRTP Java: Android runtime
(XMLA), DirectX
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner

You might also like