You are on page 1of 94

CHAPTER 1

INTRODUCTION TO OPERATING SYSTEM

Prepared by:
Mdm Nurul Ain Bt Amir Adli
Polytechnic Sultan Idris Shah, Selangor.
COURSE LEARNING OUTCOME

 Explain the concept of operating system, memory,


process and file management. (C2, PLO1).
WEEK 1
CONTENT OF TEACHING

 Explain the operating system environment.


 Describe the definition of operating system.
 Identify the basic functions of operating system.
 Describe the various type of operating system structure:
1. Monolithic
2. Layered
3. Microkernel
4. Networked / distributed

 Various architecture of OS:


1. Single processor system
2. Multiprocessor system
3. Clustered system
Definition of Operating
System
 The fundamental goal of computer systems is to
execute user programs and to make solving user
problems easier.
 the operating system is the one program running at all
times on the computer—usually called the kernel.
 An operating system acts as an intermediate between
the user of a computer and the computer hardware.
 The purpose of OS: to provide an environment in
which a user can execute programs in a convenient
and efficient manner.
The components of the
computer system

- Credits -
Continuation of previous
slide..

- Credits -
Basic Functions of OS

 the operating system is designed mostly for:


 ease of use.
 to maximize resource utilization to assure that all
available CPU time, memory, and I/0 are used efficiently
and that no individual user takes more than her fair share.
 as a resource allocator – OS involved intimately with the
hardware.
 As a control program - manages the execution of user
programs to prevent errors and improper use of the
computer.
What is Kernel?
 The core software components of an operating system.
 Main component of most computer operating systems
 Bridge between applications and the actual data processing done at
the hardware level.
 The kernel has unrestricted access to all of the resources on the system.
Kernel
Illustration
Operating System (OS) structure

 Today’s OS tend to be complex because


 they provide many services
 Support variety of hardware & software resources

 OS architecture can help designers manage this


complexity

Organize OS components
Specify the privilege with which each
component executes.
Various OS Structure
1. Monolithic
2. Layered
3. Microkernel
4. Networked / distributed
Various OS Structure
1) Monolithic
 The earliest and most common OS
 Each component of the OS was contained within the kernel
 Communicate directly with any other component
 Have unrestricted system access
 Operating system become very highly efficient
A Monolithic OS Structure
A Monolithic OS Structure
Various OS Structure

Monolithic - Disadvantage
 Disadvantage:

As monolithic kernels group


components together, therefore
difficult to isolate the source of bugs &
other errors.
Systems with monolithic kernels tend
to damage by erroneous code due
to all codes executes with
unrestricted access to the system.
Self Review

1. What is characteristic of a monolithic OS?


2. Why monolithic tend to be efficient?
3. What is the weakness of monolithic kernel?
Various OS Structure

2) Layered
 OS become larger and more complex
 Layered works by grouping components
that perform similar functions into layers.
 Each layer only communicate to its
immediate upper and lower layer.
 More modular than monolithic OS
The implementation of each layer can be
modified without requiring any
modification to other layers.
Various OS Structure

Layered
 Layered approach overcome monolithic designs by:

Grouping components that perform


similar functions into layers.
Each layer communicates ONLY to it’s
nearest upper & lower layer.
Lower layer provide service to higher-
level using interface that hides their
implementation.
Various OS Structure
Layered
 Modular: is an approach that subdivides a system into smaller parts
(modules) that can be independently created and then used in
different systems to drive multiple functionalities
 Each layer communicates only with the layers immediately above
and below it
 The modularity of layered operating systems allows the
implementation of each layer to be modified without requiring any
modification to adjacent layers
A Layered OS Structure
Various OS Structure

Layered - Disadvantage
 In layered approach, a user process’s request may need
to pass through many layers before it is serviced.
 Performance degrades compare to monolithic, which
require only a single call to service a similar request.
 Tend to damage due to erroneous code because all
layers have unrestricted access to the system.
Self Review

1. How layered architecture are more modular than


monolithic?
2. Why do layered tend to be less efficient than
monolithic?
3. Define term ‘modular’ in layered architecture.
Various OS Structure

3) Microkernel
• Includes only a very small number of services
within the kernel and scalable.
• The services typically include low-level memory
management, inter-process communication and
basic process
• Synchronization to enable processes to
cooperate.
• Most operating system components, such as
process management and device
management, execute outside the kernel with a
lower level of system access.
Various OS Structure

Microkernel
• Microkernel are highly modular, making them
extensible, portable and scalable.
• One or more components can fail, without
causing the OS damage because
microkernel does not rely on each
component to execute.
• The disadvantage of microkernel
architecture is the increased level of inter-
module communication can decrease the
system performance.
• Example: Linux, Windows XP
A Microkernel OS Structure
A Microkernel OS Structure
Self Review

 What is the difference between layered & microkernel


architecture?
Various OS Structure

4) Networked
Enables its process to access resources (e.g.,
files) that reside on other independent
computers on a network.
The structure of many networked & distributed
OS based on client/server model.
 Network File System (NFS) are an important component of
networked OS.
 allowing a user on a client computer to access files over a network
 Example: Sun’s Network File System
How client/server works?
How client/server works?
Various OS Structure
Distributed
 Is a single OS that manages resources on more than one OS.
 Provide the illusion that multiple PC are a single powerful
computer
 Hence, a process can access all of the system’s resources
regardless where the location is.
 Difficult to implement & require complicated algorithms to
enable process to communicate & share data.
 Examples:
 MIT’s Chord OS
 Amoeba OS from Vrije Universiteit (VU) in Amsterdam.
Various OS Structure
Distributed Operating system
A distributed operating system is the logical
aggregation of operating system software over
a collection of
independent, networked, communicating, and
spatially distributing computational nodes.
Individual system nodes each hold a discrete
software subset of the global aggregate
operating system.
Each node-level software subset is a
composition of two distinct service provider.
Processing is carried out independently in more
than one location, but with shared and
controlled access to some common facilities.
Networked vs Distributed

 A Network OS controls one computer but cooperates


with other computers on the network.
 In Distributed OS ,one operating system controls many
computers in a network.
Self Review

1. What is the major difference between networked &


distributed OS?
2. Give advantages of a distributed OS?
3. What is the challenge to design the distributed OS?
Various Architecture of OS

1. Single processor system


2. Multiprocessor system
3. Clustered system
Single processor system

 Definition: Only one process can run at a time; any


others must wait until the CPU is free and can be
rescheduled.
 Uniprocessor systems have only a single processor.
 For a single-processor system, there will never be more
than one running process.
Multiprocessor system
 Many processes can run simultaneously.
 A multiprocessor system - allow processes and resources (i.e.:
memory) to be shared dynamically among the various
processors.
 Multiprocessing has many CPUs to increase computing power.
 Example: Sun's operating system SunOS Version 4 & Version 5
(Solaris).
Clustered system

 It uses multiple CPUs to complete a task (same as


multiprocessor).
 It differs with multiprocessor system because the
clustered computers share storage and are closely
linked via local-area network (LAN).
 It purpose : to provide high availability (service will
continue even if one or more systems in the cluster
fail).
 ++ info: The monitoring machine can also restart
applications that were running on the failed machine-
The failed machine can remain down but the users will
see a brief of the service.
Clustered system
(example: Samba)
Exercises
1. Define an operating system. (2 marks)

2. State TWO (2) basic functions of


operating system. (2 marks).

3. State ONE (1) advantage of using


monolithic structure. (1 mark).
WEEK 2
CONTENT OF TEACHING

 Various product of OS:


1. Closed source system
2. Open source system
 Concepts in relation to OS:
1. Multitasking
2. Multiprogramming
3. Time sharing
4. Buffering
5. Spooling
6. Caching
 Components of OS:
1. Kernel
2. Shell
3. File system
Various product of OS

 Closed source system


 Open source system
Open source OS

 those available in source-code format


 Example: Linux
 Benefits: community of interested (and usually unpaid)
programmers who contribute to the code by helping to debug it,
analyze it, provide support, and suggest changes.
 open-source code is more secure than closed-source code
because many more eyes are viewing the code.
 Certainly, open-source code has bugs, but open-source
advocates argue that bugs tend to be found and fixed faster
because many people using and viewing the code.
 Revenue / profits can be generated through support contracts
and the sale of hardware on which the software runs
Closed source

 Example: Windows OS, Apple’s Mac OS X and iOS


Differences Closed source Open source
system system
Security
Concepts in relation to OS

1. Multitasking
2. Multiprogramming
3. Time sharing
4. Buffering
5. Spooling
6. Caching
1. Multitasking:
- Several processes appear to be running at the same time.
- The type of operating system most people use on their desktop and
laptop computers today.
- Example: Microsoft's Windows and Apple's MacOS platforms.
- For example, it's possible for user to be writing a note in a word
processor while downloading a file from the Internet while printing
the text of an e-mail message.
 is a method where multiple tasks (known as processes) share
common processing resources (cth: CPU).
 In the case of a computer with a single CPU, only one task is said
to be running at any point in time, meaning that the CPU is
actively executing instructions for that task.
 Multitasking solves the problem by scheduling which task may be
the one running at any given time, and when another waiting
task gets a turn.
 The act of reassigning a CPU from one task to another one is
called a context switch.
 When context switches occur frequently enough the illusion of
parallelism is achieved.
 Even on computers with more than one CPU (called
multiprocessor machines), multitasking allows many more tasks to
be run than there are CPUs.
2. Multiprogramming
- The concept of loading many programs at one time to share a
single CPU.
- A technique that allows a single processor to process several
programs residing simultaneously in main memory.
- Only allows each program to use only a preset slice of CPU time.
- Are designed to maximize the CPU usage.
 This idea is common in other life situations. A lawyer does not
work for only one client at a time, for example.
 While one case is waiting to go to trial or have papers typed,
the lawyer can work on another case.
 If he has enough clients, the lawyer will never be idle for lack of
work. (Idle lawyers tend to become politicians, so there is a
certain social value in keeping lawyers busy.)
3. Time sharing
- is the sharing of a computing resource among many users by
means of multiprogramming and multi-tasking.
Advantages:
- allows a large number of users to interact concurrently with a
single computer can lowered the cost of providing computing
capability.
 the CPU executes multiple jobs by switching among them, but
the switches occur so frequently that the users can interact with
each program while it is running.
4. Buffering
 A memory area that stores data being transferred between two
devices or between a device and an application
 The purpose of most buffers is:
 to act as a holding area
 enabling the CPU to manipulate data before transferring it to a device.
 to cope with a speed mismatch between the producer and consumer
of a data stream.
 to provide adaptations for devices that have different data-transfer
sizes.
- For example, word processors use a buffer to keep track of changes
to files.
- when you save the file, the word processor updates the disk file with
the contents of the buffer.
- More efficient than accessing the file on the disk each time you
make a change to the file.
Device transfer rates
5. Spooling
 Spool is an acronym for Simultaneous Peripheral Operation On-
Line.
 Is a buffer that holds output for a device, such as a printer, that
cannot accept interleaved data streams.
 A technique developed to speed I/O by collecting in a disk file
either input received from slow input devices, or output going
to slow output devices such as printers.
 Spooling minimizes the waiting done by the processes
performing the I/O.
Spooling illustration
6. Caching
 A cache is a component that transparently stores data so
that future requests for that data can be served faster.
 Caches are small, hence, it is cost efficient as well as the
use of data.
 Cache can be found in CPU, Disk and Web.
 For CPU cache, it is a small memories on CPU or close to
CPU, it is faster than main memory (RAM). It is managed by
hardware.
 For Disk cache, the example is the page cache in main
memory, is managed by software (OS Kernel).
Differences between
spooling, caching, buffering
Differences Buffering Spooling Caching
1. Definition

2. Example

3. Significant It is mostly used for Spooling is A cache’s sole


Used input, output, and useful for the purpose is to
sometimes devices which reduce
temporary storage have different accesses to the
of data either data access underlying
when transfer of rate. slower storage.
data takes place
or data that may
be modified in a
non-sequential
manner.
Additional info on spooling,
caching, buffering
 All three (spooling, caching, buffering) enhances performance
and makes system faster.
 a buffer may hold the only existing copy of a data item
 whereas a cache, by definition, holds a copy on faster storage
of an item that resides elsewhere.
Self review
What is the purpose of
multiprogramming?
Why the buffer were invented in
operating system development?
What is the technique used to handles
two users to print their documents
using 1 shared printer?
Exercises
1. State TWO (2) examples of open
source operating systems. (2 marks)

2. Give a situation of
multiprogramming when someone is
using a computer. (2 marks).
Components of OS

1. Kernel
2. Shell
3. File system
a) Kernel
 The part of the operating system that resides in the main memory
at all times and performs the most essential tasks, such as
managing memory and handling disk input and output.
b) Shell
 Technically known as the command interpreter.
 The main function of the command interpreter is to get and
execute the next user-specified command.
 Example of commands: create, delete, list, print, copy, execute.
 Example of shells in Linux:
 Bash shell (Bourne Again Shell)
 Csh shell
 Ksh shell.
c) File system
 A file system is the way in which files are named and where they
are placed logically for storage and retrieval.
 For example, Windows, Macintosh and Linux operating systems
all have file systems in which files are placed somewhere in a
hierarchical (tree) structure.
 A file is placed in a directory (folder in Windows) or subdirectory
at the desired place in the tree structure.
 File systems are used on data storage devices such as:
 hard disk drives
 floppy disks
 flash memory
Self Review

1. What is the function of Kernel?


2. What do you understand of shell?
3. What happened if no file system technique
implemented in any Operating system?
WEEK 3
CONTENT OF TEACHING

 The interaction by using graphical representation between


applications and the OS.
 Interfaces of OS:
1. Command Line
2. Voice Actuated
3. Graphical User Interface (GUI)
4. Web Form
 The relationship between system calls and Application Programming
Interface (API).
The interaction between
applications and the operating
system.
 The interaction between the application
and operating system is through the
Application Programming Interface (API).
 Whenever an application needs to read or
write data, it makes a call to the operating
system.
Illustration of API
Illustration of API
4 interfaces of operating
system.
1. Command line
2. Voice actuated
3. Graphical user interface (GUI)
4. Web form.
a) Command line

 A command-line interface (CLI) is a mechanism for


interacting with a computer operating
system or software by typing commands to perform
specific tasks.
 It is a text-only interface.
 This method of instructing a computer to perform a
given task is referred to as "entering" a command.
 The system waits for the user to submit the text
command by pressing the "Enter" key.
b) Voice actuated

 It involves a voice command device where


the device is controlled by the human voice.
 It removes the need to use buttons, where users can
easily use device with their hands full or while doing
other tasks.
 The example is mobile phones with voice-
activated dialing.
c) Graphical User Interface

 A user interface that allows the user to activate


operating system commands by clicking on a desktop
icon using a pointing device such as a mouse or
touch screen.
GUI of Windows 7
GUI of Macintosh
GUI of Linux Ubuntu
d) Web form

 A place where user can enter the input, such as username, and
it will be sent to the database of the server.
 Usually in web-based application, such as login page, online
registration form, online shopping, online fund transfer.
What is System Calls?

 A system call is how a program requests a service from


an operating system's kernel.
 It provide the interface between a process and the
operating system.
 Frequently, systems execute thousands of system calls
per second.
 To illustrate how system calls are used: writing a simple program
to read data from one file and copy them to another file.
 Even simple programs may make heavy use of the
operating system.
 Systems execute thousands of system calls per
second.
 But, most programmers never see the system calls in
details.
 Usually, application developers design programs
according to an Application Programming Interface
(API)
What is Application
Programming Interface (API) ?
 An API is a generic term for a way to interface with an existing library
/ service etc.
 An API specifies a set of functions that are available to an
application programmer/developer.
 Three of the most common APIs available are:
 Win32 API (Windows system)
 POSIX API (POSIX-based system : UNIX, Linux, Mac OS )
 Java API (for designing program that run on Java Virtual Machine.
The relationship between system calls
and Application Programming Interface
(API).
Cont..

 Typically, applications are programmed against an


Application Programming Interface (API), not directly
to system calls.
 An API defines a set of programming interfaces used
by applications.
 Those interfaces can be implemented as a system
call, implemented through multiple system calls, or
implemented without the use of system calls at all.
Self Review

1. How can PowerPoint application interact


with Windows OS?
2. What is the input device use in command
line interface?
3. How the voice actuated interface works?
4. Give an example of web form interface in
your real life.
5. What is the purpose of system calls?
/*Any Question?*/
//Conclusion?

You might also like