SlideShare a Scribd company logo
Department of
Computer Science and Engineering
OPERATING SYSTEMS
School of Computing
Vel Tech Rangarajan Dr. Sagunthala R&D Institute of
Science and Technology
Faculty Name : P.GIRIJA
UNIT - 1
Department of Computer Science and Engineering
Course Content
2
UNIT I OPERATING SYSTEMS OVERVIEW 9
 Operating system overview: Objectives
 Functions
 Computer System Organization
 Operating System Structure
 Operating System Operations
 System Calls
 System Programs
Department of Computer Science and Engineering
Learning Resources
3
and Project
Management
(SEPM)
Text Books
1. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System Concepts”, 9th
Edition, John Wiley and Sons Inc., 2012.
2.Richard Petersen, “Linux: The Complete Reference”, 6th Edition, Tata McGraw-Hill, 2008.
Reference Books
1. Andrew S. Tanenbaum, “Modern Operating Systems”, 4th Edition, Prentice Hall, Wesley,
2014.
2.William Stallings, “Operating Systems – Internals and Design Principles”, 7th Edition,
Prentice Hall, 2011.
3.Harvey M. Deitel, “Operating Systems”, 7th Edition, Prentice Hall, 2003.
4.D M Dhamdhere, “Operating Systems: A Concept-Based Approach”, 2nd Edition, Tata
McGraw-Hill Education, 2007.
5.Charles Crowley, “Operating Systems: A Design-Oriented Approach”, Tata McGraw Hill
Education”, 1996.
Digital Resources
1.http://www.tutorialspoint.com/operating_system/
2.http://www.mu.ac.in/myweb_test/MCA%20study%20material/OS%20-%20PDF.pdf
3.http://codex.cs.yale.edu/avi/os-book/OS8/os8c/slide-dir/PDF-dir/ch2.pdf
4.http://www.freebookcentre.net/CompuScience/Free-Operating-Systems-Books-download.html
/
Department of Computer Science and Engineering
Why you need to learn os?
4
and Project
Management
(SEPM)
 OS is a key part of a computer system
 It is the most important software that runs on a computer. It
manages the computer’s
 Memory
 Processes
 Software
 Hardware.
 It also allows you to communicate with the computer.
Department of Computer Science and Engineering
• An Operating System (OS) is an interface between a computer
user and computer hardware.
• An operating system ( OS) is system software that manages
computer hardware and software resources, and provides common
services for computer programs .
• An operating system is a program that acts as an interface between the user and
the computer hardware and controls the execution of all kinds of programs.
5
OPERATING SYSTEMS - Definition
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting codes
Coordination between other software and users
Department of Computer Science and Engineering
• Execute user Program & make solving user problems easier.
• Make the computer System convenient to use.
• Use the computer hardware in an efficient manner.
Goals of an operating System
Department of Computer Science and Engineering
• Hardware
• Operating system
• Application programs
• Users
Four main components of Computer
Department of Computer Science and Engineering
• 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
Computer system can be divided into four components:
Department of Computer Science and Engineering
Views of Operating Systems
Department of Computer Science and Engineering
• Bootstrap program is loaded at power-up or reboot
• Typically stored in ROM or EPROM, generally known as
firmware
• Initializes all aspects of system
• Loads operating system kernel and starts execution
Computer Start up
Department of Computer Science and Engineering
Computer System Organization
Department of Computer Science and Engineering
Computer System Organization
• Computer-system operation
• One or more CPUs, device controllers connect through common
bus providing access to shared memory
• 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
Department of Computer Science and Engineering
• Device controller informs CPU that it has finished its operation by
causing an interrupt
• Interrupt transfers control to the interrupt service routine generally,
through the interrupt vector, which contains the addresses of all the
service routines
• Interrupt architecture must save the address of the interrupted
instruction
• A trap or exception is a software-generated interrupt caused either by
an error or a user request
• An operating system is interrupt driven
INTERRUPTS
Department of Computer Science and Engineering
INTERRUPTS
Department of Computer Science and Engineering
• The OS preserves the state of the CPU by storing registers and the
program counter
• Determines which type of interrupt has occurred:
polling
• The interrupt controller polls (send a signal out to) each device to
determine which one made the request
vectored - interrupt system
• Separate segments of code determine what action should be taken
for each type of interrupt
INTERRUPT HANDLING
Department of Computer Science and Engineering
INTERRUPT TIMELINE
Department of Computer Science and Engineering
STORAGE HIERARCHY
Department of Computer Science and Engineering
• Storage is the only one of many types of I/O devices within a computer.
• A large portion of OS code is dedicated to managing I/O
• Because of its importance of reliability & performance.
• Computer system consists of CPU & multiple devices controllers through
common bus.
• Each device controller is in charge of a specific types of devices.
I/O STRUCTURE
Department of Computer Science and Engineering
DEVICE CONTROLLER
• Maintains local buffer storage & set of Special purpose registers.
DEVICE DRIVER
• OS have a device driver for each device controller.
• Device driver understands the device controller & gives uniform interface
to the rest of the OS.
• Device controller transfers blocks of data from buffer storage directly to
main memory without CPU intervention
• Only one interrupt is generated per block, rather than the one interrupt per
byte.
I/O STRUCTURE
Department of Computer Science and Engineering
DEVICE CONTROLLER
CPU
ADDRESS BUS
DATA BUS
Registers Registers
LOCAL BUFFERS
MAIN MEMORY
Department of Computer Science and Engineering
• To start an IO operations ,device driver loads the appropriate registers within
the device controller.
• Device controller in turns examines the content of these registers to
determine what action to take.
• The controller starts the transfer of data from the device to its local buffer.
• Once the transfer of data is complete ,the device controller informs the device
driver via an interrupt that it has finished its operations.
• Device driver then return the control to OS.
Issue:
• This form of interrupt driven IO is fine for moving small amounts of data.
• But can produce high overhead when used for bulk data movement.
Working of I/O operations
Department of Computer Science and Engineering
DMA(DIRECT MEMORY ACCESS)
• To solve the above problem ,DMA is used.
• After setting up buffers, pointers & counters for IO devices, the
device controller transfers an entire block of data directly to or from
its own buffer storage to memory without intervention of CPU.
• Only one interrupt is generated per block, to tell the device driver
that the operation has completed.
• While the device controller is performing these operations , CPU is
available to accomplish other works.
Working of I/O operations
Department of Computer Science and Engineering
How a Modern Computer Works
Department of Computer Science and Engineering
OPERATING SYSTEM STRUCTURE
COMMONALITIES
MULTIPROGRAMMING
MULTI TASKING
(TIME SHARING)
Department of Computer Science and Engineering
• Multiprogramming (Batch system) needed for efficiency
• Capability of running multiple programs by the CPU.
• It increases CPU utilization by organizing jobs (code and data) so CPU
always has one to execute.
• Single program (user) cannot keep CPU and I/O devices busy at all times
• A subset of total jobs in system is kept in memory
• One job selected and run via job scheduling
• When it has to wait (for I/O for example), OS switches to another job
OPERATING SYSTEM STRUCTURE
JOB
1
J
JOB
3
JOB
2
JOB
4
JOB POOL
Department of Computer Science and Engineering
• Timesharing (multitasking) is logical extension in which CPU
• switches occurs so frequently that users can interact with each job while it
is running, creating interactive computing
• Response time should be < 1 second
• Each user has at least one program executing in memory process
• If several jobs ready to run at the same time  CPU scheduling
• If processes don’t fit in memory, swapping moves them in and out to
run
• Virtual memory allows execution of processes not completely in
memory
OPERATING SYSTEM STRUCTURE
Department of Computer Science and Engineering
• UNIX is a powerful Operating
System initially developed by
Ken Thompson, Dennis
Ritchie at AT&T Bell
laboratories in 1970.
Department of Computer Science and Engineering
• Features of UNIX Operating System
Department of Computer Science and Engineering
• Multitasking: A UNIX operating system is a multitasking operating system that allows you
to initiate more than one task from the same terminal so that one task is performed as a
foreground and the other task as a background process.
• Multi-user: UNIX operating system supports more than one user to access computer
resources like main memory, hard disk, tape drives, etc
• Portability: This feature makes the UNIX work on different machines and platforms with
the easy transfer of code to any computer system.
• File Security and Protection: Being a multi-user system, UNIX makes special consideration
for file and system security.
• Communication: In UNIX, communication is an excellent feature that enables the user to
communicate worldwide. It supports various communication facilities provided using the
write command, mail command, talk command, etc.
• Open Source: UNIX operating system is open source it means it is freely available to all
and is a community-based development project.
• Accounting: UNIX keeps an account of jobs created by the user.
• UNIX Tools and Utilities:like compiler ,interpreter...etc for unix grep,sed,awk etc...
Department of Computer Science and Engineering
• The structure of Unix OS Layers are as follows:
Department of Computer Science and Engineering
• Interrupt driven (hardware and software)
• Hardware interrupt by one of the devices
• Software interrupt (exception or trap):
• Software error (e.g., division by zero or invalid memory access)
• Request for operating system service
• For each type of interrupt separate segment of code in the OS
determine what action should be taken.
• ISR [Interrupt Service Routine] provided to deal with interrupt.
• A properly designed OS ensure that an incorrect or malicious program cannot
cause other programs to execute incorrectly.
Operating-System Operations
Department of Computer Science and Engineering
• Dual-mode operation allows OS to protect itself and other system components
2 MODES OF OPERATIONS
DUAL MODE & MULTI MODE OPERATIONS
User mode
kernel mode or Supervised
mode or privileged mode.
Department of Computer Science and Engineering
• Mode bit
• Added to hardware of the computer.
• To indicate the current mode
• Kernel (0)
• User (1)
• System executing a user application – User mode.
• User Application request a service from OS (via System call).
• System must translate from user mode to kernel mode to fulfill the
request.
DUAL MODE & MULTI MODE OPERATIONS
Department of Computer Science and Engineering
DUAL MODE & MULTI MODE OPERATIONS
Department of Computer Science and Engineering
• Hardware starts in kernel mode.
• OS is then loaded & starts user application in user mode.
• Whenever trap or interrupt occurs ,the hardware switches
from user mode to kernel mode.
• OS gains the control of computer in kernel mode.
• The system always switches to user mode before passing
control to a user program.
System Boot
Department of Computer Science and Engineering
• The hardware allows these instructions to be executed only
in kernel mode.
• Example:
• The instructions to switch to kernel mode.
• I/O control
• Timer management
• Interrupt management
Privileged Instructions(System Calls)
Department of Computer Science and Engineering
• CPU uses more than one bit to set & test the mode.
• CPU supports virtualization frequently have a separate mode to
indicate when the Virtual Machine Manager(VMM) & the
virtualization management software VMs is in control of the
system.
• VMM has more privileges than user processes but fewer than the
kernel.
• Example
• Intel 64 family of CPU supports 4 privileged levels & virtualization
but does not have separate mode for virtualization.
Beyond two modes[multi mode operations]
Department of Computer Science and Engineering
• Provides the user program to ask the operating system to perform tasks
reserved for the OS.
• It is invoked in variety of ways.
• Usually it takes the form of a trap to a specific location in the interrupt vector.
• Trap executed by a generic trap instruction ,syscall instruction to invoke a
system call.
• When system call is executed ,hardware treated it as software interrupt.
• Control passes through interrupt vector to a service routine & mode bit is set
to kernel mode.
• The kernel examines the interrupting instruction to determine what system
call has occurred.
SYSTEM CALL
Department of Computer Science and Engineering
• A parameter indicates what type of service the user program is
requesting.
• Additional information passed in registers, on the stack or in memory.
• Kernel verifies that parameters are correct & legal, execute the request
& returns control to the instruction following the system call.
No bit mode
• Lack of hardware supported with dual mode cause serious short
comings.
Example
• MS DOS – Intel Architecture has no mode bit & no dual mode.
Example for Dual mode
• Windows 10,UNIX, Linux
SYSTEM CALL
Department of Computer Science and Engineering
• Programming interface to the services provided by the OS.
• Typically written in a high-level language (C or C++)
SYSTEM CALLS
User Mode
Kernel
Mode
Department of Computer Science and Engineering
Examples - SYSTEM CALLS
• System call sequence to copy the contents of one file to another file
Department of Computer Science and Engineering
• Acquire input File name:
• To enter the file name
• 2 ways are there
• Through keyboard
• Mouse
• Frequently system execute thousands of system calls per second.
Examples - SYSTEM CALLS
Department of Computer Science and Engineering
• Specifies set of functions that are available to an application programmer,
including parameters passed to each functions & return values the
programmer can expect.
• Mostly accessed by programs via a high-level Application
Programming Interface (API) rather than direct system call .
•
SYSTEM CALLS - APIs
Department of Computer Science and Engineering
Examples of Standard APIs
Department of Computer Science and Engineering
• Why application programmer prefer programming according to API than
invoking system calls?
• Program portability
• Application programmer design a program using an API can expect her
program to compile & run on any system that supports the same API.
SYSTEM CALLS - APIs
Department of Computer Science and Engineering
• Many programming languages provides a system call interface.
• It serves as the link to system calls made available by operating system.
• It intercepts function calls in the API & invokes the necessary system call written
the OS.
• A number is associated with each system call.
• It maintains a table indexed according to these numbers.
• It invokes intended system call in OS kernel & returns status of the system calls &
any return values.
• The caller need know nothing about how the system call is implemented.
• Just need only obey the API & understand what OS will do as a result of system
call.
• Most detail of OS interface hidden from programmer by API.
• Managed by run time support library (set of functions built into libraries included
with compiler)
SYSTEM CALLS interface
Department of Computer Science and Engineering
API – System Call – OS Relationship
Department of Computer Science and Engineering
Standard C Library Example
• C program invoking printf() library call, which calls write() system call
Department of Computer Science and Engineering
• Often, more information is required than simply identity of desired
system call
• Exact type and amount of information vary according to OS and call
• Three general methods used to pass parameters to the OS
• Simplest: pass the parameters in registers
• In some cases, may be more parameters than registers
• Parameters stored in a block, or table, in memory, and address of
block passed as a parameter in a register
• This approach taken by Linux and Solaris
• Parameters placed, or pushed, onto the stack by the program and
popped off the stack by the operating system
• Block and stack methods do not limit the number or length of
parameters being passed
SYSTEM CALLS Parameter passing
Department of Computer Science and Engineering
SYSTEM CALLS Parameter passing
Department of Computer Science and Engineering
• Process control
• create process, terminate process
• end, abort
• load, execute
• get process attributes, set process attributes
• wait for time
• wait event, signal event
• allocate and free memory
• Dump memory if error
• Debugger for determining bugs, single step execution
• Locks for managing access to shared data between processes
Types of System Calls
Department of Computer Science and Engineering
• File management
• create file, delete file
• open, close file
• read, write, reposition
• get and set file attributes
• Device management
• request device, release device
• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
Types of System Calls
Department of Computer Science and Engineering
• Information maintenance
• get time or date, set time or date
• get system data, set system data
• get and set process, file, or device attributes
• Communications
• create, delete communication connection
• send, receive messages if message passing model to host name or
process name
• From client to server
• Shared-memory model create and gain access to memory regions
• transfer status information
• attach and detach remote devices
Types of System Calls
Department of Computer Science and Engineering
Examples of Windows and Unix System Calls
Department of Computer Science and Engineering
SYSTEM PROGRAMS
Department of Computer Science and Engineering
• Provide a convenient environment for program development and
execution.
• Some of them are simply user interfaces to system calls;
• others are considerably more complex
• System programs are divided into following categories
• File manipulation
• Status information sometimes stored in a File modification
• Programming language support
• Program loading and execution
• Communications
• Background services
• Application programs
SYSTEM PROGRAMS- Definition
Department of Computer Science and Engineering
File management
• Create,
• delete,
• copy,
• rename,
• print,
• dump,
• list, and
• generally manipulate files and directories
SYSTEM PROGRAMS - Categories
Department of Computer Science and Engineering
Status information
• Ask the system for info
Simple information's
• date,
• time,
• amount of available memory,
• disk space,
• number of users
Complex information's
• Detailed performance,
• logging, and
• debugging information,etc.
SYSTEM PROGRAMS - Categories
Department of Computer Science and Engineering
File modification
• Several Text editors may be available to create and modify the
content of files stored on disk or other storage devices.
• Special commands to search contents of files or perform
transformations of the text
SYSTEM PROGRAMS - Categories
Department of Computer Science and Engineering
Programming-language support
• Compilers,
• assemblers,
• debuggers and
• Interpreters
• For some common programming languages (such as C,C++,JAVA ,Visual
Basic & PERL)
• Provided to the user with the operating system.
SYSTEM PROGRAMS - Categories
Department of Computer Science and Engineering
Program loading and execution
• Once a program is assembled or compiled , it must be loaded into
memory to be executed.
• Absolute loaders,
• Relocatable loaders,
• linkage editors, and
• overlay-loaders,
• Debugging systems for higher-level or machine language are needed.
SYSTEM PROGRAMS - Categories

More Related Content

PDF
Engg-0505-IT-Operating-Systems-2nd-year.pdf
PDF
operating systems hybrid notes for computerscience.pdf
PDF
Operating Systems PPT 1 (1).pdf
PPTX
What is operating system
PDF
OS Content.pdf
PDF
introduction to operating system
PDF
MK Sistem Operasi.pdf
PDF
PB1MAT_TIF17 - Pertemuan 1-2ghfctrerdxt.pdf
Engg-0505-IT-Operating-Systems-2nd-year.pdf
operating systems hybrid notes for computerscience.pdf
Operating Systems PPT 1 (1).pdf
What is operating system
OS Content.pdf
introduction to operating system
MK Sistem Operasi.pdf
PB1MAT_TIF17 - Pertemuan 1-2ghfctrerdxt.pdf

Similar to operating system basics including mac os (20)

PDF
Operating System
PDF
PPTX
What is an Operating Systems?
PPT
Introduction to Operating System
PPTX
Operating Systems Module 1 Session 1.pptx
PPTX
CSE3120- Module1 part 1 v1.pptx
PDF
Kernel security Concepts
PPT
chapter1.ppt
PPTX
Computer system architecture
PPTX
introduction to operating systems and services.pptx
PPTX
Fundamental_of_Digital_Computer and its architecture
PPTX
EDITED JNNIE_Sample Lecture PPT-Template.pptx
PPTX
Nt introduction(os)
PPT
Computer Architecture & Organization.ppt
PPTX
Introduction to OS.pptx
PDF
Operating systems-chapter-1 silberschatz
PDF
Os notes 1_5
PPT
1 os_intro.pptThis is the presentation we use to delever in Amity University
PPTX
Operating system introduction and introduction
Operating System
What is an Operating Systems?
Introduction to Operating System
Operating Systems Module 1 Session 1.pptx
CSE3120- Module1 part 1 v1.pptx
Kernel security Concepts
chapter1.ppt
Computer system architecture
introduction to operating systems and services.pptx
Fundamental_of_Digital_Computer and its architecture
EDITED JNNIE_Sample Lecture PPT-Template.pptx
Nt introduction(os)
Computer Architecture & Organization.ppt
Introduction to OS.pptx
Operating systems-chapter-1 silberschatz
Os notes 1_5
1 os_intro.pptThis is the presentation we use to delever in Amity University
Operating system introduction and introduction
Ad

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Presentation on HIE in infants and its manifestations
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Institutional Correction lecture only . . .
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Cell Structure & Organelles in detailed.
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
RMMM.pdf make it easy to upload and study
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Microbial diseases, their pathogenesis and prophylaxis
Microbial disease of the cardiovascular and lymphatic systems
Presentation on HIE in infants and its manifestations
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Institutional Correction lecture only . . .
Abdominal Access Techniques with Prof. Dr. R K Mishra
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Chinmaya Tiranga quiz Grand Finale.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
Module 4: Burden of Disease Tutorial Slides S2 2025
102 student loan defaulters named and shamed – Is someone you know on the list?
Cell Structure & Organelles in detailed.
Final Presentation General Medicine 03-08-2024.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
RMMM.pdf make it easy to upload and study
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Ad

operating system basics including mac os

  • 1. Department of Computer Science and Engineering OPERATING SYSTEMS School of Computing Vel Tech Rangarajan Dr. Sagunthala R&D Institute of Science and Technology Faculty Name : P.GIRIJA UNIT - 1
  • 2. Department of Computer Science and Engineering Course Content 2 UNIT I OPERATING SYSTEMS OVERVIEW 9  Operating system overview: Objectives  Functions  Computer System Organization  Operating System Structure  Operating System Operations  System Calls  System Programs
  • 3. Department of Computer Science and Engineering Learning Resources 3 and Project Management (SEPM) Text Books 1. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System Concepts”, 9th Edition, John Wiley and Sons Inc., 2012. 2.Richard Petersen, “Linux: The Complete Reference”, 6th Edition, Tata McGraw-Hill, 2008. Reference Books 1. Andrew S. Tanenbaum, “Modern Operating Systems”, 4th Edition, Prentice Hall, Wesley, 2014. 2.William Stallings, “Operating Systems – Internals and Design Principles”, 7th Edition, Prentice Hall, 2011. 3.Harvey M. Deitel, “Operating Systems”, 7th Edition, Prentice Hall, 2003. 4.D M Dhamdhere, “Operating Systems: A Concept-Based Approach”, 2nd Edition, Tata McGraw-Hill Education, 2007. 5.Charles Crowley, “Operating Systems: A Design-Oriented Approach”, Tata McGraw Hill Education”, 1996. Digital Resources 1.http://www.tutorialspoint.com/operating_system/ 2.http://www.mu.ac.in/myweb_test/MCA%20study%20material/OS%20-%20PDF.pdf 3.http://codex.cs.yale.edu/avi/os-book/OS8/os8c/slide-dir/PDF-dir/ch2.pdf 4.http://www.freebookcentre.net/CompuScience/Free-Operating-Systems-Books-download.html /
  • 4. Department of Computer Science and Engineering Why you need to learn os? 4 and Project Management (SEPM)  OS is a key part of a computer system  It is the most important software that runs on a computer. It manages the computer’s  Memory  Processes  Software  Hardware.  It also allows you to communicate with the computer.
  • 5. Department of Computer Science and Engineering • An Operating System (OS) is an interface between a computer user and computer hardware. • An operating system ( OS) is system software that manages computer hardware and software resources, and provides common services for computer programs . • An operating system is a program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs. 5 OPERATING SYSTEMS - Definition
  • 6. Department of Computer Science and Engineering
  • 7. Department of Computer Science and Engineering
  • 8. Department of Computer Science and Engineering Memory Management Processor Management Device Management File Management Security Control over system performance Job accounting Error detecting codes Coordination between other software and users
  • 9. Department of Computer Science and Engineering • Execute user Program & make solving user problems easier. • Make the computer System convenient to use. • Use the computer hardware in an efficient manner. Goals of an operating System
  • 10. Department of Computer Science and Engineering • Hardware • Operating system • Application programs • Users Four main components of Computer
  • 11. Department of Computer Science and Engineering • 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 Computer system can be divided into four components:
  • 12. Department of Computer Science and Engineering Views of Operating Systems
  • 13. Department of Computer Science and Engineering • Bootstrap program is loaded at power-up or reboot • Typically stored in ROM or EPROM, generally known as firmware • Initializes all aspects of system • Loads operating system kernel and starts execution Computer Start up
  • 14. Department of Computer Science and Engineering Computer System Organization
  • 15. Department of Computer Science and Engineering Computer System Organization • Computer-system operation • One or more CPUs, device controllers connect through common bus providing access to shared memory • 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
  • 16. Department of Computer Science and Engineering • Device controller informs CPU that it has finished its operation by causing an interrupt • Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines • Interrupt architecture must save the address of the interrupted instruction • A trap or exception is a software-generated interrupt caused either by an error or a user request • An operating system is interrupt driven INTERRUPTS
  • 17. Department of Computer Science and Engineering INTERRUPTS
  • 18. Department of Computer Science and Engineering • The OS preserves the state of the CPU by storing registers and the program counter • Determines which type of interrupt has occurred: polling • The interrupt controller polls (send a signal out to) each device to determine which one made the request vectored - interrupt system • Separate segments of code determine what action should be taken for each type of interrupt INTERRUPT HANDLING
  • 19. Department of Computer Science and Engineering INTERRUPT TIMELINE
  • 20. Department of Computer Science and Engineering STORAGE HIERARCHY
  • 21. Department of Computer Science and Engineering • Storage is the only one of many types of I/O devices within a computer. • A large portion of OS code is dedicated to managing I/O • Because of its importance of reliability & performance. • Computer system consists of CPU & multiple devices controllers through common bus. • Each device controller is in charge of a specific types of devices. I/O STRUCTURE
  • 22. Department of Computer Science and Engineering DEVICE CONTROLLER • Maintains local buffer storage & set of Special purpose registers. DEVICE DRIVER • OS have a device driver for each device controller. • Device driver understands the device controller & gives uniform interface to the rest of the OS. • Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention • Only one interrupt is generated per block, rather than the one interrupt per byte. I/O STRUCTURE
  • 23. Department of Computer Science and Engineering DEVICE CONTROLLER CPU ADDRESS BUS DATA BUS Registers Registers LOCAL BUFFERS MAIN MEMORY
  • 24. Department of Computer Science and Engineering • To start an IO operations ,device driver loads the appropriate registers within the device controller. • Device controller in turns examines the content of these registers to determine what action to take. • The controller starts the transfer of data from the device to its local buffer. • Once the transfer of data is complete ,the device controller informs the device driver via an interrupt that it has finished its operations. • Device driver then return the control to OS. Issue: • This form of interrupt driven IO is fine for moving small amounts of data. • But can produce high overhead when used for bulk data movement. Working of I/O operations
  • 25. Department of Computer Science and Engineering DMA(DIRECT MEMORY ACCESS) • To solve the above problem ,DMA is used. • After setting up buffers, pointers & counters for IO devices, the device controller transfers an entire block of data directly to or from its own buffer storage to memory without intervention of CPU. • Only one interrupt is generated per block, to tell the device driver that the operation has completed. • While the device controller is performing these operations , CPU is available to accomplish other works. Working of I/O operations
  • 26. Department of Computer Science and Engineering How a Modern Computer Works
  • 27. Department of Computer Science and Engineering OPERATING SYSTEM STRUCTURE COMMONALITIES MULTIPROGRAMMING MULTI TASKING (TIME SHARING)
  • 28. Department of Computer Science and Engineering • Multiprogramming (Batch system) needed for efficiency • Capability of running multiple programs by the CPU. • It increases CPU utilization by organizing jobs (code and data) so CPU always has one to execute. • Single program (user) cannot keep CPU and I/O devices busy at all times • A subset of total jobs in system is kept in memory • One job selected and run via job scheduling • When it has to wait (for I/O for example), OS switches to another job OPERATING SYSTEM STRUCTURE JOB 1 J JOB 3 JOB 2 JOB 4 JOB POOL
  • 29. Department of Computer Science and Engineering • Timesharing (multitasking) is logical extension in which CPU • switches occurs so frequently that users can interact with each job while it is running, creating interactive computing • Response time should be < 1 second • Each user has at least one program executing in memory process • If several jobs ready to run at the same time  CPU scheduling • If processes don’t fit in memory, swapping moves them in and out to run • Virtual memory allows execution of processes not completely in memory OPERATING SYSTEM STRUCTURE
  • 30. Department of Computer Science and Engineering • UNIX is a powerful Operating System initially developed by Ken Thompson, Dennis Ritchie at AT&T Bell laboratories in 1970.
  • 31. Department of Computer Science and Engineering • Features of UNIX Operating System
  • 32. Department of Computer Science and Engineering • Multitasking: A UNIX operating system is a multitasking operating system that allows you to initiate more than one task from the same terminal so that one task is performed as a foreground and the other task as a background process. • Multi-user: UNIX operating system supports more than one user to access computer resources like main memory, hard disk, tape drives, etc • Portability: This feature makes the UNIX work on different machines and platforms with the easy transfer of code to any computer system. • File Security and Protection: Being a multi-user system, UNIX makes special consideration for file and system security. • Communication: In UNIX, communication is an excellent feature that enables the user to communicate worldwide. It supports various communication facilities provided using the write command, mail command, talk command, etc. • Open Source: UNIX operating system is open source it means it is freely available to all and is a community-based development project. • Accounting: UNIX keeps an account of jobs created by the user. • UNIX Tools and Utilities:like compiler ,interpreter...etc for unix grep,sed,awk etc...
  • 33. Department of Computer Science and Engineering • The structure of Unix OS Layers are as follows:
  • 34. Department of Computer Science and Engineering • Interrupt driven (hardware and software) • Hardware interrupt by one of the devices • Software interrupt (exception or trap): • Software error (e.g., division by zero or invalid memory access) • Request for operating system service • For each type of interrupt separate segment of code in the OS determine what action should be taken. • ISR [Interrupt Service Routine] provided to deal with interrupt. • A properly designed OS ensure that an incorrect or malicious program cannot cause other programs to execute incorrectly. Operating-System Operations
  • 35. Department of Computer Science and Engineering • Dual-mode operation allows OS to protect itself and other system components 2 MODES OF OPERATIONS DUAL MODE & MULTI MODE OPERATIONS User mode kernel mode or Supervised mode or privileged mode.
  • 36. Department of Computer Science and Engineering • Mode bit • Added to hardware of the computer. • To indicate the current mode • Kernel (0) • User (1) • System executing a user application – User mode. • User Application request a service from OS (via System call). • System must translate from user mode to kernel mode to fulfill the request. DUAL MODE & MULTI MODE OPERATIONS
  • 37. Department of Computer Science and Engineering DUAL MODE & MULTI MODE OPERATIONS
  • 38. Department of Computer Science and Engineering • Hardware starts in kernel mode. • OS is then loaded & starts user application in user mode. • Whenever trap or interrupt occurs ,the hardware switches from user mode to kernel mode. • OS gains the control of computer in kernel mode. • The system always switches to user mode before passing control to a user program. System Boot
  • 39. Department of Computer Science and Engineering • The hardware allows these instructions to be executed only in kernel mode. • Example: • The instructions to switch to kernel mode. • I/O control • Timer management • Interrupt management Privileged Instructions(System Calls)
  • 40. Department of Computer Science and Engineering • CPU uses more than one bit to set & test the mode. • CPU supports virtualization frequently have a separate mode to indicate when the Virtual Machine Manager(VMM) & the virtualization management software VMs is in control of the system. • VMM has more privileges than user processes but fewer than the kernel. • Example • Intel 64 family of CPU supports 4 privileged levels & virtualization but does not have separate mode for virtualization. Beyond two modes[multi mode operations]
  • 41. Department of Computer Science and Engineering • Provides the user program to ask the operating system to perform tasks reserved for the OS. • It is invoked in variety of ways. • Usually it takes the form of a trap to a specific location in the interrupt vector. • Trap executed by a generic trap instruction ,syscall instruction to invoke a system call. • When system call is executed ,hardware treated it as software interrupt. • Control passes through interrupt vector to a service routine & mode bit is set to kernel mode. • The kernel examines the interrupting instruction to determine what system call has occurred. SYSTEM CALL
  • 42. Department of Computer Science and Engineering • A parameter indicates what type of service the user program is requesting. • Additional information passed in registers, on the stack or in memory. • Kernel verifies that parameters are correct & legal, execute the request & returns control to the instruction following the system call. No bit mode • Lack of hardware supported with dual mode cause serious short comings. Example • MS DOS – Intel Architecture has no mode bit & no dual mode. Example for Dual mode • Windows 10,UNIX, Linux SYSTEM CALL
  • 43. Department of Computer Science and Engineering • Programming interface to the services provided by the OS. • Typically written in a high-level language (C or C++) SYSTEM CALLS User Mode Kernel Mode
  • 44. Department of Computer Science and Engineering Examples - SYSTEM CALLS • System call sequence to copy the contents of one file to another file
  • 45. Department of Computer Science and Engineering • Acquire input File name: • To enter the file name • 2 ways are there • Through keyboard • Mouse • Frequently system execute thousands of system calls per second. Examples - SYSTEM CALLS
  • 46. Department of Computer Science and Engineering • Specifies set of functions that are available to an application programmer, including parameters passed to each functions & return values the programmer can expect. • Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call . • SYSTEM CALLS - APIs
  • 47. Department of Computer Science and Engineering Examples of Standard APIs
  • 48. Department of Computer Science and Engineering • Why application programmer prefer programming according to API than invoking system calls? • Program portability • Application programmer design a program using an API can expect her program to compile & run on any system that supports the same API. SYSTEM CALLS - APIs
  • 49. Department of Computer Science and Engineering • Many programming languages provides a system call interface. • It serves as the link to system calls made available by operating system. • It intercepts function calls in the API & invokes the necessary system call written the OS. • A number is associated with each system call. • It maintains a table indexed according to these numbers. • It invokes intended system call in OS kernel & returns status of the system calls & any return values. • The caller need know nothing about how the system call is implemented. • Just need only obey the API & understand what OS will do as a result of system call. • Most detail of OS interface hidden from programmer by API. • Managed by run time support library (set of functions built into libraries included with compiler) SYSTEM CALLS interface
  • 50. Department of Computer Science and Engineering API – System Call – OS Relationship
  • 51. Department of Computer Science and Engineering Standard C Library Example • C program invoking printf() library call, which calls write() system call
  • 52. Department of Computer Science and Engineering • Often, more information is required than simply identity of desired system call • Exact type and amount of information vary according to OS and call • Three general methods used to pass parameters to the OS • Simplest: pass the parameters in registers • In some cases, may be more parameters than registers • Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register • This approach taken by Linux and Solaris • Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system • Block and stack methods do not limit the number or length of parameters being passed SYSTEM CALLS Parameter passing
  • 53. Department of Computer Science and Engineering SYSTEM CALLS Parameter passing
  • 54. Department of Computer Science and Engineering • Process control • create process, terminate process • end, abort • load, execute • get process attributes, set process attributes • wait for time • wait event, signal event • allocate and free memory • Dump memory if error • Debugger for determining bugs, single step execution • Locks for managing access to shared data between processes Types of System Calls
  • 55. Department of Computer Science and Engineering • File management • create file, delete file • open, close file • read, write, reposition • get and set file attributes • Device management • request device, release device • read, write, reposition • get device attributes, set device attributes • logically attach or detach devices Types of System Calls
  • 56. Department of Computer Science and Engineering • Information maintenance • get time or date, set time or date • get system data, set system data • get and set process, file, or device attributes • Communications • create, delete communication connection • send, receive messages if message passing model to host name or process name • From client to server • Shared-memory model create and gain access to memory regions • transfer status information • attach and detach remote devices Types of System Calls
  • 57. Department of Computer Science and Engineering Examples of Windows and Unix System Calls
  • 58. Department of Computer Science and Engineering SYSTEM PROGRAMS
  • 59. Department of Computer Science and Engineering • Provide a convenient environment for program development and execution. • Some of them are simply user interfaces to system calls; • others are considerably more complex • System programs are divided into following categories • File manipulation • Status information sometimes stored in a File modification • Programming language support • Program loading and execution • Communications • Background services • Application programs SYSTEM PROGRAMS- Definition
  • 60. Department of Computer Science and Engineering File management • Create, • delete, • copy, • rename, • print, • dump, • list, and • generally manipulate files and directories SYSTEM PROGRAMS - Categories
  • 61. Department of Computer Science and Engineering Status information • Ask the system for info Simple information's • date, • time, • amount of available memory, • disk space, • number of users Complex information's • Detailed performance, • logging, and • debugging information,etc. SYSTEM PROGRAMS - Categories
  • 62. Department of Computer Science and Engineering File modification • Several Text editors may be available to create and modify the content of files stored on disk or other storage devices. • Special commands to search contents of files or perform transformations of the text SYSTEM PROGRAMS - Categories
  • 63. Department of Computer Science and Engineering Programming-language support • Compilers, • assemblers, • debuggers and • Interpreters • For some common programming languages (such as C,C++,JAVA ,Visual Basic & PERL) • Provided to the user with the operating system. SYSTEM PROGRAMS - Categories
  • 64. Department of Computer Science and Engineering Program loading and execution • Once a program is assembled or compiled , it must be loaded into memory to be executed. • Absolute loaders, • Relocatable loaders, • linkage editors, and • overlay-loaders, • Debugging systems for higher-level or machine language are needed. SYSTEM PROGRAMS - Categories