Chapter 3 - CENG METU

Download Report

Transcript Chapter 3 - CENG METU

Chapter 3:
Operating Systems
Computer Science: An Overview
Twelfth Edition
Chapter 3: Operating Systems
•
•
•
•
•
The History of Operating Systems
Operating System Architecture
Coordinating the Machine’s Activities
Handling Competition Among Processes
Security
3-2
Functions of Operating Systems
•
•
•
•
•
Oversee operation of computer
Store and retrieve files
Schedule programs for execution
Coordinate the execution of programs
Resource management
3-3
• Queue
• FIFO: First in First Out
• LIFO : Last in First Out
3-4
Evolution of Shared Computing
• Batch processing
• Interactive processing
– Requires real-time processing
• Time-sharing/Multitasking
– Implemented by Multiprogramming
• Multiprocessor machines
• Load balancing
3-5
Medical devices, vehicle
electronics, home appliances,
cell phones, or other hand-held
computers. The computer
systems found in these devices
are known as embedded
systems.
3-6
Batch processing
3-7
Interactive processing
3-8
Types of Software
• Application software
– Performs specific tasks for users
• System software
– Provides infrastructure for application software
– Consists of operating system and utility
software
• utility software consists of software units that extend (or
perhaps customize) the capabilities of the operating
system.
3-9
Software classification
3-10
Kernel
The kernel is a computer program that is the core of a
computer's operating system, with complete control over
everything in the system.
It is the first program loaded on start-up.
It handles the rest of start-up as well as input/output requests
from software, translating them into data-processing
instructions for the central processing unit.
It handles memory and peripherals like keyboards, monitors,
printers, speakers.
3-11
Operating System Components
• User Interface: Communicates with users
– Text based (Shell)
– Graphical user interface (GUI)
• Kernel: Performs basic required functions
– File manager
– Device drivers
– Memory manager (virtual memory)
– Scheduler and dispatcher
3-12
The user interface acts as an intermediary
between users and the operating system
kernel
3-13
File Manager
• Directory (or Folder): A user-created
bundle of files and other directories
(subdirectories)
• Directory Path: A sequence of directories
within directories
3-14
Memory Manager
• Allocates space in main memory
• May create the illusion that the machine
has more memory than it actually does
(virtual memory) by playing a “shell
game” in which blocks of data (pages) are
shifted back and forth between main
memory and mass storage
3-15
Virtual memory
• Paging:
The memory manager may create the illusion
of additional memory space by rotating
programs and data back and forth between
main memory and mass storage.
3-16
Getting it Started (Bootstrapping)
• Boot loader: Program in ROM (example of
firmware)
– Run by the CPU when power is turned on
– Transfers operating system from mass storage
to main memory
– Executes jump to operating system
3-17
The booting process
3-18
Processes
• Process: The activity of executing a program
• Process State: Current status of the activity
– Program counter
– General purpose registers
– Related portion of main memory
3-19
Process Administration
• Scheduler: Adds new processes to the
process table and removes completed
processes from the process table
• Dispatcher: Controls the allocation of time
slices to the processes in the process table
– The end of a time slice is signaled by an
interrupt.
3-20
Time-sharing between process A and B
3-21
Process State
•
As a process executes, it changes state
– new: The process is being created
– running: Instructions are being executed
– waiting: The process is waiting for some event to occur (such
as an I/O completion or reception of a signal)
– ready: The process is waiting to be assigned to a processor
– terminated: The process has finished execution
• HERE….
3-23
Process Control Block (PCB)
Information associated with each
process
• Process state
• Program counter
• CPU registers
• CPU scheduling information
• Memory-management information
• Accounting information
• I/O status information
• Preemption,
• Interrupt
• Time slices to execute processes
3-25
Thread: a thread of execution is the smallest sequence of
programmed instructions that can be managed
independently by a scheduler, which is typically a part of the
operating system
3-26
Handling Competition for
Resources
• Semaphore: A “control flag”
• Critical Region: A group of
instructions that should be
executed by only one process
at a time
• Mutual exclusion:
Requirement for proper
implementation of a critical
region
3-27
Deadlock
• Processes block each other from continuing
• Conditions required for deadlock
1. Competition for non-sharable resources
2. Resources requested on a partial basis
3. An allocated resource can not be forcibly retrieved
One process may have access to the computer’s printer but be
waiting for access to the computer’s CD player, while another
process has access to the CD player but is waiting for the
printer.
3-28
A deadlock resulting from competition for
nonshareable railroad intersections
3-29
• Killing a process
• Holding data for output at a later but more
convenient time is called spooling. Like in a printer.
• a file manager may allocate file access according to
the needs of the processes, allowing several
processes to have read access but allowing only
one to have write access.
3-30
777 permissions of Linux for file access
• 0 – no permission
1 – execute
2 – write
3 – write and execute
4 – read
5 – read and execute
6 – read and write
7 – read, write, and execute
2-31
Multi-Core Operating Systems
• Traditional time-sharing/multitasking systems give
the illusion of executing many processes at once
by switching rapidly between time slices faster
than a human can perceive.
• Modern systems continue to multitask in this way,
but in addition, the latest multi-core CPUs are
genuinely capable of running two, four, or many
more processes simultaneously.
3-32
Security
• Attacks from outside
– Problems
• Insecure passwords
• Sniffing software (recording your activities)
– Counter measures
• Auditing software (record and analyze)
3-33
Security (continued)
• Attacks from within
– Problem: Unruly processes
– Counter measures: Control process activities
via privileged modes and privileged
instructions
– Accessing to the memory of other processes.
3-34
Trojan Horses
a Trojan horse is a malicious program that is disguised
as legitimate software.
Like the gift horse left outside the gates of Troy by the
Greeks, Trojan Horses appear to be useful or interesting
to an unsuspecting user, but are actually harmful
3-35