Chapter 1
Chapter 1
By:Kumera Ch.
1
What is operating system
• Operating system acts as an intermediary between a user of a computer
and the computer hardware.
• Operating system goals:
Execute user programs and make solving user problems easier.
Make the computer system convenient to use.
Use the computer hardware in an efficient manner.
• Operating System Functions:
Resource allocator - manages and allocates resources.
Control program - controls the execution of user programs and
operation of I/O devices.
Kernel - the one program running at all times (all else being
application programs).
2
Purpose of an operating System
• An operating system is the level of programming that lets you
do things with your computer.
• The operating system interacts with a computer's hardware on a
basic level, transmitting your commands into language the
hardware can interpret. The OS acts as a platform for all other
applications on your machine.
• Without it, your computer would just be a paperweight.
• Operating systems are like the manager for a computer.
• It's the job of the OS to monitor what software needs and what
the hardware can provide.
• As you run applications on your computer, the OS allocates the
resources necessary to complete the task.
3
Cont..
• That can include processing power, memory allocation and
computer storage access, among other things.
• Ideally, the OS will make sure that your computer's hardware is
never overtaxed.
• The OS also allows programs to run on a computer.
• Without an OS, a programmer would have to design an application
to run on the hardware directly.
– This isn't very efficient.
• An operating system acts as an application interface to the hardware.
The OS does this through an application program interface (API).
• Program developers build applications for the API. Assuming the
programmer has done a good job at building an application without
any serious bugs, it should run just fine on the operating system.
4
Computer system organization
• Computer system can be divided into four components
• Hardware – provides basic computing resources
– CPU, memory, I/O devices
• Operating 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
5
Computer system operation
• 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
6
History of operating system
• In the 1950s some technologies emerged that allowed a “simpler”
interaction between the user and the computer.
• Resident monitor: - this is a system that loads the program into the
computer, reading it from a tape or punched cards.
• This technology gave rise to the first operating system in history,
created in 1956 for an IBM 704 computer, which was responsible for
loading programs successively (starting with the next one when the
previous one had finished loading), reducing the work time required.
• Temporary storage: this is a system that also tried to increase speed by
simultaneously loading programs and executing tasks. In the 1960s, the
rise of the integrated circuit launched the power of computers, and
operating systems responded by becoming increasingly complex and
offering new techniques.
7
Cont..
• In the 1970s, IT continued to become increasingly complex, resulting in
the first versions of some of the operating systems that have served as
the basis for many of the ones we use today, such as UNIX.
• The operating systems of this decade are still available only to highly
qualified users, and their complexity means that they consume a large
amount of resources. Among the most outstanding, in addition to UNIX,
we find MULTICS, BDOS and CP/M, widely used in computers with
Intel microprocessor.
• The 1980s gave rise to the boom in commercial computing. The arrival
of computers in thousands of offices and homes changes the focus of
operating systems, forcing the development of more user-friendly
systems that introduced graphic elements such as menus.
8
Cont..
• In this decade the development is such that it gives rise to some
operating systems already legendary, and that contribute to the rise of
computing in later decades, such as C++, SunOS (developed by Sun
Microsystems and derived from UNIX), AmigaOS (developed for the
Commodore Amiga) and some classics such as these:-
• MS-DOS: - developed by Microsoft for IBM PCs, which contributed
enormously to the popularization of computing and gave rise to
Windows systems.
• Mac OS: - a system of Macintosh computers developed by Apple Inc,
launched in 1984, and which included a novel graphic interface and the
use of the mouse (a rarity at that time for users that were used to typing
commands).
• The decade of the 90’s continues with the explosive line marked in the
80’s, giving rise to many of the operating systems that, in more modern
versions, we use today: 9
Cont..
• GNU/Linux: it was developed based on UNIX, and which is one of the
greatest exponents of free software. Today, GNU/Linux is widely used
all over the world, having a pre-eminence close to 100% in fields as
striking as supercomputers.
• Solaris: - also developed on UNIX basis by Sun Microsystems for
servers and workstations.
• Microsoft Windows: - which has resulted in a popular family of
commercially successful operating systems used by millions of users
around the world.
• In the first decade of the present century, new operating systems
continue to succeed each other, perhaps with less impact than those that
emerged in the previous decade, but have their own place. Highlights
include SymbOS, MorphOS, Darwin, Mac OS, Haiku and OpenSolaris.
10
Cont..
• So now we see the current decade, in which the rise of phones gives rise
to some popular operating systems, including Android, developed by
Google or iOS, created by Apple.
11
The Operating System as an Extended
Machine
• The architecture (instruction set, memory organization, I/O,
and bus structure) of most computers at the machine language
level is primitive and awkward to program, especially for
input/output.
• The function of the operating system is to present the user with
the equivalent of an extended machine or virtual machine that
is easier to program than the underlying hardware.
12
The Operating System as a Resource
Manager
• Modern computers consist of
– processors,
– memories,
– timers,
– disks,
– mice,
– network interfaces,
– printers, and a wide variety of other devices.
• The job of the operating system is to provide for an orderly and
controlled allocation of the processors, memories, and I/O
devices among the various programs competing for them.
13
Cont..
• Resource management includes multiplexing (sharing) resources in
two ways:
– In time and In space.
1. Time multiplexing:- When a resource is time multiplexed, different
programs or users take turns using it. First one of them gets to use
the resource, then another, and so on.
– For example, with only one CPU and multiple programs that want to run
on it, the operating system first allocates the CPU to one program, and
then after it has run long enough, another one gets to use the CPU, then
another, and then eventually the first one again.
2. Space multiplexing :- Instead of the customers taking turns, each
one gets part of the resource.
– For example, main memory is normally divided up among several running
programs, so each one can be resident at the same time (for example, in
order to take turns using the CPU). 14
The Meaning of an interrupt
• An interrupt is a function of an operating system that provides
multi-process multi-tasking.
• The interrupt is a signal that prompts the operating system to
stop work on one process and start work on another.
• Interrupt is a signal emitted by hardware or software when a
process or an event needs immediate attention.
• It alerts the processor to a high-priority process requiring
interruption of the current working process.
• In I/O devices one of the bus control lines is dedicated for this
purpose and is called the Interrupt Service Routine (ISR).
15
Process vs Thread
• A process is basically a program in execution. The execution of
a process must progress in a sequential fashion.
• A thread is a path of execution within a process. A process can
contain multiple threads.
Why Multithreading?
• A thread is also known as lightweight process. The idea is to
achieve parallelism by dividing a process into multiple threads.
– For example, in a browser, multiple tabs can be different threads.
MS Word uses multiple threads: one thread to format the text,
another thread to process inputs, etc.
16
Concurrency
• Concurrency is the tendency for
things to happen at the same time in
a system. Concurrency is a natural
phenomenon, of course.
• In the real world, at any given time,
many things are happening
simultaneously.
• When we design software to monitor
and control real-world systems, we
must deal with this natural
concurrency.
19
Preemptive Scheduling
• Preemptive scheduling is used when a process switches from
running state to ready state or from the waiting state to ready
state.
• The resources (mainly CPU cycles) are allocated to the process
for a limited amount of time and then taken away, and the
process is again placed back in the ready queue if that process
still has CPU burst time remaining. That process stays in the
ready queue till it gets its next chance to execute.
20
Non-Preemptive Scheduling
• Non-preemptive Scheduling is used when a process terminates,
or a process switches from running to the waiting state. In this
scheduling, once the resources are allocated to a process, the
process holds the CPU till it gets terminated or reaches a
waiting state.
• In the case of non-preemptive scheduling does not interrupt a
process running CPU in the middle of the execution. Instead, it
waits till the process completes its CPU burst time, and then it
can allocate the CPU to another process.
21
Dispatcher
• A dispatcher is a module, it connects the CPU to the process
selected by the scheduler.
• The main function of the dispatcher are:
– Switching;- it means switching the CPU from one process to
another process.
– Jumping to the proper location in the user program and ready to
start execution. The time taken by the dispatcher to stop one process
and start another running is called the Dispatch Latency.
• The degree of multiprogramming is dependent on the dispatch
latency. If the dispatch latency is increasing, then the degree of
multiprogramming decreases.
22
Memory management
• It is a features of the operating system help the computer system in
allocating the main memory space to the processes and their data at the
time of execution. Along with the allocation of main memory space to
processes, memory management also performs the following activities:
• Upgrading performance
– Memory management also helps in upgrading the performance of computer
system. Due to memory management of the computer system, the computer system
remains stable and gives a good performance as a result.
• Execution of multiple processes
– Memory management enables the execution of multiple processes at the same time
in the computer system.
• Utilization of memory space
– Memory management shares the same memory space among different processes.
Hence we can perform many tasks at a particular memory space.
23
Device Management
• An Operating System manages device communication via their
respective drivers.
• It does the following activities for device management −
– Keeps tracks of all devices. Program responsible for this task is
known as the I/O controller.
– Decides which process gets the device when and for how much
time.
– Allocates the device in the efficient way.
– De-allocates devices.
24
File Management
• A file system is normally organized into directories for easy
navigation and usage.
• These directories may contain files and other directions.
– An Operating System does the following activities for file
management
– Keeps track of information, location, uses, status etc. The collective
facilities are often known as file system.
– Decides who gets the resources.
– Allocates the resources.
– De-allocates the resources.
25
Other Important Activities
• Following are some of the important activities that an
Operating System performs −
– Security − By means of password and similar other techniques, it
prevents unauthorized access to programs and data.
– Control over system performance − Recording delays between
request for a service and response from the system.
– Job accounting − Keeping track of time and resources used by
various jobs and users.
– Error detecting aids − Production of dumps, traces, error messages,
and other debugging and error detecting aids.
– Coordination between other software's and users − Coordination
and assignment of compilers, interpreters, assemblers and other
software to the various users of the computer systems.
26