Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Operating Systems Lecture Notes, Exercises of Computer Science

Lecture notes on Operating Systems for B.Tech II Year – I Sem (R18) (2019-2020) at Malla Reddy College of Engineering & Technology. It covers topics such as OS fundamentals, process and thread handling, memory management, and inter-process communication. The document also discusses the objectives of an OS, its functions, and types of systems such as multiprocessor and clustered systems.

Typology: Exercises

2021/2022

Available from 11/03/2023

sai-shravani
sai-shravani 🇮🇳

1 document

1 / 133

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OPERATING SYSTEMS
[R18A0504]
LECTURE NOTES
B.TECH II YEAR I SEM (R18)
(2019-2020)
DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
MALLA REDDY COLLEGE OF ENGINEERING &
TECHNOLOGY
(Autonomous Institution UGC, Govt. of India)
Recognized under 2(f) and 12 (B) of UGC ACT 1956
(Affiliated to JNTUH, Hyderabad, Approved by AICTE - Accredited by NBA & NAAC ‘A’ Grade - ISO 9001:2015 Certified)
Maisammaguda, Dhulapally (Post Via. Hakimpet), Secunderabad 500100, Telangana State, India
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Operating Systems Lecture Notes and more Exercises Computer Science in PDF only on Docsity!

OPERATING SYSTEMS

[R18A0504]

LECTURE NOTES

B.TECH II YEAR – I SEM (R18)

DEPARTMENT OF

COMPUTER SCIENCE AND ENGINEERING

MALLA REDDY COLLEGE OF ENGINEERING &

TECHNOLOGY

(Autonomous Institution – UGC, Govt. of India)

Recognized under 2(f) and 12 (B) of UGC ACT 1956 (Affiliated to JNTUH, Hyderabad, Approved by AICTE - Accredited by NBA & NAAC – ‘A’ Grade - ISO 9001:2015 Certified) Maisammaguda, Dhulapally (Post Via. Hakimpet), Secunderabad – 500100, Telangana State, India

MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY

II Year B. Tech CSE ‐ I Sem L T/P/D C 3 - /-/- 3 (R18A0504) OPERATING SYSTEMS OBJECTIVES:  To learn the fundamentals of Operating Systems.  To learn the mechanisms of OS to handle processes and threads and their communication  To learn the mechanisms involved in memory management in contemporary OS  To gain knowledge on distributed operating system concepts that includes architecture,  Mutual exclusion algorithms, deadlock detection algorithms and agreement protocols  To know the components and management aspects of concurrency management UNIT-I Introduction: Concept of Operating Systems, Generations of Operating systems, Types of Operating Systems, OS Services, System Calls, Structure of an OS - Layered, Monolithic, Microkernel Operating Systems, Concept of Virtual Machine. Case study on UNIX and WINDOWS Operating System. Processes: Definition, Process Relationship, Different states of a Process, Process State transitions, Process Control Block (PCB), Context switching Thread: Definition, Various states, Benefits of threads, Types of threads, Concept of Multithreads. UNIT-II Process Scheduling : Foundation and Scheduling objectives, Types of Schedulers, Scheduling criteria: CPU utilization, Throughput, Turnaround Time, Waiting Time, Response Time; Scheduling algorithms: Pre-emptive and Non pre-emptive, FCFS, SJF, RR; Multiprocessor scheduling: Real Time scheduling: RM and EDF. Inter-process Communication: Critical Section, Race Conditions, Mutual Exclusion,Hardware Solution, Strict Alternation, Peterson’s Solution, The Producer/Consumer Problem, Semaphores, Event Counters, Monitors, Message Passing, Classical IPC Problems: Reader’s & Writer Problem, Dinning Philosopher Problem etc. UNIT-III Memory Management: Basic concept, Logical and Physical address map, Memory allocation: Contiguous Memory allocation – Fixed and variable partition–Internal and External fragmentation and Compaction; Paging: Principle of operation – Page allocation – Hardware support for paging, protection and sharing, Disadvantages of paging. Virtual Memory : Basics of Virtual Memory – Hardware and control structures – Locality of reference, Page fault , Working Set , Dirty page/Dirty bit – Demand paging, Page Replacement algorithms: Optimal, First in First Out (FIFO), Second Chance (SC), Not recently used (NRU) and Least Recently used (LRU).

INDEX

UNIT

NO

TOPIC PAGE NO

I

Introduction Operating System concepts 1 - 11 Types of Operating Systems 11 - 18 Operating services, System Calls 18 - 25 Structure of OS, Virtual machines 26 - 31 Process Concepts 32 - 34 Thread Concepts 34 - 38 II Process Scheduling Process Scheduling concepts 39 -^40 Pre-emptive and Non pre-emptive scheduling algorithms

Multiprocessor scheduling 48 - 49 Real time scheduling 49 - 52 Inter-process Communication Critical Section problem 52 - 57 Classical IPC Problems 57 - 65 III Memory Management^66 -^82 Virtual Memory 82 - 89 IV File System Management 90 - 105 I/O Hardware 105 - 110 V Deadlocks 111 - 119 Mass Storage Structure^120 -^129

UNIT-I

Operating System Introduction: Operating Systems Objectives and functions, Computer System Architecture, OS Structure, OS Operations, Evolution of Operating Systems - Simple Batch, Multi programmed, time shared, Personal Computer, Parallel, Distributed Systems, Real-Time Systems, Special - Purpose Systems, Operating System services, user OS Interface, System Calls, Types of System Calls, System Programs, Operating System Design and Implementation, OS Structure, Virtual machines

Operating system performs the following functions:

  1. Booting Booting is a process of starting the computer operating system starts the computer to work. It checks the computer and makes it ready to work.
  2. Memory Management It is also an important function of operating system. The memory cannot be managed without operating system. Different programs and data execute in memory at one time. if there is no operating system, the programs may mix with each other. The system will not work properly.
  3. Loading and Execution A program is loaded in the memory before it can be executed. Operating system provides the facility to load programs in memory easily and then execute it.
  4. Data security Data is an important part of computer system. The operating system protects the data stored on the computer from illegal use, modification or deletion.
  5. Disk Management Operating system manages the disk space. It manages the stored files and folders in a proper way.
  6. Process Management CPU can perform one task at one time. if there are many tasks, operating system decides which task should get the CPU.
  7. Device Controlling operating system also controls all devices attached to computer. The hardware devices are controlled with the help of small software called device drivers..
  8. Providing interface It is used in order that user interface acts with a computer mutually. User interface controls how you input data and instruction and how information is displayed on screen. The operating system offers two types of the interface to the user:
  9. Graphical-line interface: It interacts with of visual environment to communicate with the computer. It uses windows, icons, menus and other graphical objects to issues commands.
  10. Command-line interface:it provides an interface to communicate with the computer by typing commands.

Computer System Architecture Computer system can be divided into four components (^) H a r d w a r e – provides basic computing resources CPU, memory, I/O devices, (^) Oper at ing system Controls and coordinates use of hardware among various applications and users Application programs – define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers, web browsers, database systems, video games Users People, machines, other computers Four Components of a Computer System Computer architecture means construction/design of a computer. A computer system may be organized in different ways. Some computer systems have single processor and others have multiprocessors. So based on the processors used in computer systems, they are categorized into the following systems.

  1. Single-processor system
  2. Multiprocessor system
  3. Clustered Systems:
  4. Single-Processor Systems: Some computers use only one processor such as microcomputers (or personal computers PCs). On a single-processor system, there is only one CPU that performs all the activities in the computer system. However, most of these systems have other special purpose processors, such as I/O processors that move data quickly among different components of the computers. These processors execute only a limited system programs and do not run the user program. Sometimes

For example, different processors in the system can communicate with each other. Similarly, an I/O can be processed on any processor. However, I/O must be controlled to ensure that the data reaches the appropriate processor. Because all the processors share the same memory, so the input data given to the processors and their results must be separately controlled. Today all modern operating systems including Windows and Linux provide support for SMP. It must be noted that in the same computer system, the asymmetric multiprocessing and symmetric multiprocessing technique can be used through different operating systems. A Dual-Core Design

  1. Clustered Systems: Clustered system is another form of multiprocessor system. This system also contains multiple processors but it differs from multiprocessor system. The clustered system consists of two or more individual systems that are coupled together. In clustered system, individual systems (or clustered computers) share the same storage and are linked together ,via Local Area Network (LAN). A layer of cluster software runs on the cluster nodes. Each node can monitor one or more of the other nodes over the LAN. If the monitored machine fails due to some technical fault (or due to other reason), the monitoring machine can take ownership of its storage. The monitoring machine can also restart the applications that were running on the failed machine. The users of the applications see only an interruption of service. Types of Clustered Systems: Like multiprocessor systems, clustered system can also be of two types (i). Asymmetric Clustered System (ii). Symmetric Clustered System (i). Asymmetric Clustered System: In asymmetric clustered system, one machine is in hot-standby mode while the other

machine is running the application. The hot-standby host machine does nothing. It only monitors the active server. If the server fails, the hot-standby machine becomes the active server. (ii). Symmetric Clustered System: In symmetric clustered system, multiple hosts (machines) run the applications. They also monitor each other. This mode is more efficient than asymmetric system, because it uses all the available hardware. This mode is used only if more than one application be available to run. Operating System – Structure Operating System Structure Multiprogramming needed for efficiency Single user cannot keep CPU and I/O devices busy at all times Multiprogramming organizes jobs (code and data) so CPU always has one to Execute A subset of total jobs in system is kept in memory

  1. Multitasking

Operating-system Operations

  1. Dual-Mode Operation· In order to ensure the proper execution of the operating system, we must be able to distinguish between the execution of operating-system code and user defined code. The approach taken by most computer systems is to provide hardware support that allows us to differentiate among various modes of execution. At the very least we need two separate modes of operation.user mode and kernel mode. A bit, called the mode bit is added to the hardware of the computer to indicate the current mode: kernel (0) or user (1).with the mode bit we are able to distinguish between a task that is executed on behalf of the operating system and one that is executed on behalf of the user, When the computer system is executing on behalf of a user application, the system is in user mode. However, when a user application requests a service from the operating system (via a.. system call), it must transition from user to kernel mode to fulfill the request. At system boot time, the hardware starts in kernel mode. The operating system is then loaded and starts user applications in user mode. Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel mode (that is, changes the state of the mode bit to 0). Thus, whenever the operating system gains control of the computer, it is in kernel mode. The system always switches to user mode (by setting the mode bit to 1) before passing control to a user program.

Personal-Computer Systems(PCs) A personal computer (PC) is a small, relatively inexpensive computer designed for an individual user. In price, personal computers range anywhere from a few hundred dollars to thousands of dollars. All are based on the microprocessor technology that enables manufacturers to put an entire CPU on one chip. At home, the most popular use for personal computers is for playing games. Businesses use personal computers for word processing, accounting, desktop publishing, and for running spreadsheet and database management applications.

Special purpose systems a) Real-Time EmbeddedSystems These devices are found everywhere, from car engines and manufacturing robots to DVDs and microwave ovens. They tend to have very specific tasks. They have little or no user interface, preferring to spend their time monitoring and managing hardware devices, such as automobile engines and robotic arms.