Module 1 - Chapter - 1
Module 1 - Chapter - 1
DEPARTMENT OF CSE
OPERATING SYSTEM
MODULE-1
OS OVERVIEW AND SYSTEM STRUCTURE
CHAPTER 1
INTRODUCTION
TO
OPERATING SYSTEMS
1. WHAT IS AN OPERATING SYSTEM?
4
1. 1 WHY STUDY OS?
• OS is a key part of a computer system
– it is “magic” and we want to understand how
– it has “power” and we want to have the power
• OS is complex
– What happens when your running application program ?
-- Real OS is huge and very expensive to build
-- win/NT: 8 years, 1000s of people
5
OVERVIEW OF OS
6
2. COMPUTER SYSTEM STRUCTURE
8
3. WHAT OPERATING SYSTEMS DO
3.1 VIEWS
9
3. WHAT OPERATING SYSTEMS DO
10
3.2 OPERATING SYSTEM DEFINITION
11
3.3 NEED OF OS
■ Multi-Tasking
12
4. COMPUTER SYSTEM ORGANIZATION
13
4.1 COMPUTER SYSTEM OPERATION
• One or more CPUs, device controllers connect through
common bus providing access to shared memory
• Concurrent execution of CPUs and devices competing
for memory cycles
14
4.1 Computer System Operation
• I/O devices and the CPU can execute concurrently.
• Each device controller is in charge of a particular
device type.
• Each device controller has a local buffer.
• CPU moves data from/to main memory to/from local
buffers.
• I/O is from the device to local buffer of controller.
• Device controller informs CPU that it has finished its
operation by causing an interrupt.
15
4.1 Computer System Operation
Common functions of interrupts
• Interrupt transfers control to the interrupt service routine generally,
through the interrupt vector, which contains the addresses of all the
service routines.
16
17
4.1 Computer System Operation
INTERRUPT TIMELINE
18
4.2 Storage Structure
•Main memory – only large storage media that the CPU can access directly
•Random access
•Typically volatile
•Secondary storage – extension of main memory that provides large
nonvolatile storage capacity
•Hard disks – rigid metal or glass platters covered with magnetic recording
material
•Disk surface is logically divided into tracks, which are subdivided into
sectors
•The disk controller determines the logical interaction between the
device and the computer
•Solid-state disks – faster than hard disks, nonvolatile
•Various technologies
•Becoming more popular 19
4. 2 Storage Structure
Storage Hierarchy
• Storage systems organized in hierarchy
• Speed
• Cost
• Volatility
• Caching – copying information into faster storage system;
main memory can be viewed as a cache for secondary storage
• Device driver for each device controller to manage I/O
• Provides uniform interface between controller and kernel
20
4.2 Storage Structure
STORAGE DEVICE HIERARCHY
21
4.2 Storage Structure
23
4.3 I/O STRUCTURE
• A device controller maintains some local buffer storage
and a set of special-purpose registers. The device
controller is responsible for moving the data between the
peripheral devices that it controls and its local buffer
storage. Typically, operating systems have a device driver
for each device controller.
• Driver understands the device controller and presents a
uniform interface to the device to the rest of the operating
system.
24
4.3 I/O STRUCTURE
26
5. COMPUTER SYSTEM ARCHITECTURE
27
5.1 SINGLE PROCESSOR SYSTEM
28
5.2 MULTI -PROCESSOR SYSTEM
Advantages include:
1. Increased throughput
2. Economy of scale
3. Increased reliability
Two types:
4. Asymmetric Multiprocessing – each processor is
assigned a specie task. 29
5. Symmetric Multiprocessing – each processor performs
all tasks
5.2 MULTI -PROCESSOR SYSTEM
30
5.3 CLUSTERED SYSTEMS
31
5.3 CLUSTERED SYSTEMS
32
6 .OPERATING SYSTEM STRUCTURE
33
6. OPERATING SYSTEM STRUCTURE
35
Multi Programming System
36
6. OPERATING SYSTEM STRUCTURE
6.2. Timesharing (multitasking) is logical extension in which cpu
switches jobs so frequently that users can interact with each job while it
is running, creating interactive computing.
38
7. OPERATING-SYSTEM OPERATIONS
• Interrupt driven (hardware and software)
• Hardware interrupt by one of the devices
• Software interrupt (exception or trap):
• Software error (e.g., Division by zero)
• Request for operating system service
• Other process problems include infinite loop, processes
modifying each other or the operating system
OPERATIONS:
1. DUAL MODE
2. TIMER
39
7. OPERATING-SYSTEM OPERATIONS
• 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. 40
7. OPERATING-SYSTEM OPERATIONS
42
7. OPERATING-SYSTEM OPERATIONS
7.2 TIMER
• Typically system has many processes, some user, some operating system
running concurrently on one or more CPUs. 44
45
9. MEMORY MANAGEMENT
• To execute a program all (or part) of the instructions must be in
memory
• All (or part) of the data that is needed by the program must be in
memory.
• Memory management determines what is in memory and when
• Optimizing CPU utilization and computer response to users
• Memory management activities
• Keeping track of which parts of memory are currently being used
and by whom
• Deciding which processes (or parts thereof) and data to move into
and out of memory 46
47
10. STORAGE MANAGEMENT
48
10. STORAGE MANAGEMENT
49
10. STORAGE MANAGEMENT
10.2. MASS STORAGE MANAGEMENT :
Usually disks used to store data that does not fit in main memory or data that
must be kept for a “long” period of time
• Proper management is of central importance
• Entire speed of computer operation hinges on disk subsystem and its
algorithms
• OS activities
• Free-space management
• Storage allocation
• Disk scheduling
• Some storage need not be fast
• Tertiary storage includes optical storage, magnetic tape
• Still must be managed – by OS or applications
50
• Varies between WORM (write-once, read-many-times) and RW (read-
write)
10. STORAGE MANAGEMENT
10.3. Caching is an important principle of computer systems.
Information is normally kept in some storage system (such as
main memory).
• As it is used, it is copied into a faster storage system—the
cache—on a temporary basis.
• When we need a particular piece of information, we first
check whether it is in the cache.
• If it is, we use the information directly from the cache; if it
is not, we use the information from the source, putting a
copy in the cache under the assumption that we will need it
again soon. 51
10. STORAGE MANAGEMENT
10.3. Caching
Performance of Various Levels of Storage
52
10. STORAGE MANAGEMENT
10.3. Caching
In a hierarchical storage structure, the same data may appear in different levels of the
storage system.
• For example, suppose that an integer A that is to be incremented by 1 is located in
file B, and file B resides on magnetic disk. The increment operation proceeds by first
issuing an I/O operation to copy the disk block on which A resides to main memory.
• This operation is followed by copying A to the cache and to an internal register.
Thus, the copy of A appears in several places: on the magnetic disk, in main memory,
in the cache, and in an internal register .
• Once the increment takes place in the internal register, the value of A differs in the
various storage systems. The value of A becomes the same only after the new value
of A is written from the internal register back to the magnetic disk.
53
10. STORAGE MANAGEMENT
10.3. Caching
54
10. STORAGE MANAGEMENT
10.3. Caching
• The situation becomes more complicated in a multiprocessor environment where, in
addition to maintaining internal registers, each of the CPUs also contains a local cache.
• In such an environment, a copy of A may exist simultaneously in several caches. Since the
various CPUs can all execute concurrently, we must make sure that an update to the value of
A in one cache is immediately reflected in all other caches where A resides.
• This situation is called cache coherency, and it is usually a hardware problem (handled
below the operating-system level).
56
11. PROTECTION AND SECURITY
• Protection – any mechanism for controlling access of processes or
users to resources defined by the OS
• Security – defense of the system against internal and external attacks
• Huge range, including denial-of-service, worms, viruses, identity
theft, theft of service
• Systems generally first distinguish among users, to determine who
can do what
• User identities (user ids, security ids) include name and
associated number, one per user
• User ID then associated with all files, processes of that user to
determine access control
• Group identifier (group ID) allows set of users to be defined and
controls managed, then also associated with each process, file
• Privilege escalation allows user to change to effective ID with57
more rights
12. DISTRIBUTED SYSTEMS
• A distributed system is a collection of physically separate, possibly heterogeneous
computer systems that are networked to provide the users with access to the various
resources that the system maintains.
• Access to a shared resource increases computation speed, functionality, data
availability, and reliability.
• A network, in the simplest terms, is a communication path between two or more
systems.
• Distributed systems depend on networking for their functionality. Networks vary by
the protocols used, the distances between nodes, and the transport media. TCP/IP is
the most common network protocol, although ATM and other protocols are in
widespread use.
• Likewise, operating system support of protocols varies. Most operating systems
support TCP/IP, including the windows and UNIX operating systems. 58Some
systems support proprietary protocols to suit their needs
12. DISTRIBUTED SYSTEMS
Networks are characterized based on the distances between their nodes.
▪ A local-area network (LAN) connects computers within a room, a floor, or a
building.
▪ A wide-area network (WAN) usually links buildings, cities, or countries. A
global company may have a WAN to connect its offices worldwide. These
networks may run one protocol or several protocols.
▪ A metropolitan-area network (MAN) could link buildings within a city.
Bluetooth and 802.11 devices use wireless technology to communicate over a
distance of several feet, in essence creating a small-area network such as
might be found in a home.
60
13. COMPUTING ENVIRONMENT
61
13. COMPUTING ENVIRONMENT
62
13. COMPUTING ENVIRONMENT