0% found this document useful (0 votes)
46 views

Computer System Organization

The computer system consists of CPUs, device controllers, and shared memory connected via a common bus. Device controllers manage I/O devices and transfer data between controllers using local buffers. The CPU and controllers execute concurrently competing for memory access, managed by the memory controller. During startup, the bootstrap program initializes all components and loads the OS kernel. The OS then waits for and responds to events like interrupts or system calls to maintain control of the CPU while servicing requests and managing processes, memory, storage, and protection of system resources.

Uploaded by

Ronald Domingo
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Computer System Organization

The computer system consists of CPUs, device controllers, and shared memory connected via a common bus. Device controllers manage I/O devices and transfer data between controllers using local buffers. The CPU and controllers execute concurrently competing for memory access, managed by the memory controller. During startup, the bootstrap program initializes all components and loads the OS kernel. The OS then waits for and responds to events like interrupts or system calls to maintain control of the CPU while servicing requests and managing processes, memory, storage, and protection of system resources.

Uploaded by

Ronald Domingo
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 61

Computer System

Organization
Computer System Organization
• Consists of one or more CPUs and a
number of device controllers connected
through a common bus that provides
access to shared memory.

• Device controller
– In charge of a specific type of device
– Responsible for moving data from one
controller to another. Each device
controller has a local buffer.
Computer System Operation
Computer System Operation
• CPU and device controller executes
concurrently competing for memory cycles.

• Memory controller is provided to ensure


orderly and synchronized access to the shared
memory.

• Device controller informs CPU that it has


finished its operation by causing an interrupt

• Initialization of all these components is done


during the booting the system (start-up)
Bootstrap Program
• Stored in ROM/EEPROM
• Executed first during booting
• Bootstrapping – the process of
initializing the computer and loading
the OS
– Usually occurs when the computer is
powered-up or reset.
a. Initialize all aspects of the system
b. Locate OS kernel from disk and load it to
memory
c. OS takes control of the CPU.
Bootstrapping
IVT (Interrupt Vector Table)

• Reserved area in RAM containing


device interrupt numbers with their
corresponding addresses (fixed
location) of where to find the code
(service routine) in the ROM.
DTA (Data Table Area)
• Reserved area in RAM containing the
conditions / states of all the devices
the detected.
• Examples:
– Disk drive – read/write, busy, available
– Keyboard – Shift key is pressed, Num
lock, Caps lock, etc.
– Printer – on-line, off-line, out of paper,
etc.
Once loaded, how does the OS know what to do
next?

• It waits for some event to occur: e.g.


The user typing a command on the
keyboard.

• The OS gets the control of the CPU


(which may be busy waiting for an
event or be in a busy loop) when
either an external or an internal
event (or an exception) occurs.
Examples of external events
• Character typed at console

• Completion of an I/O operation


(controller is ready to do more work)

• Timer: to make sure OS eventually


gets control.
Interrupts
• An interrupt is a signal sent to the
CPU by an external device, I/O.
• CPU will check interrupts only after it
has completed the processing of one
instruction (asynchronous) and
before it fetches another one.
• Exact occurrence time of an interrupt
is not known and it is not
predictable.
Examples of Internal events
• System call/monitor call – special
operation triggered by the software

• Error item (e.g. illegal instruction,


addressing violation)

• Page fault
Traps
• A trap is an abnormal condition
detected by the CPU (software
generated) that is indicative of an error
(synchronous with CPU).

– Example: attempt to divide a number by


zero, accessing memory location that does
not exist or for which the program does not
have access, executing an instruction with
an undefined opcode, or trying to access a
non-existing I/O device.
Fundamental Structures
• When the CPU receives an
interrupt
– The current state of the CPU is saved
in some specific location (PSW).
– CPU resumes execution at some
other specific location – the interrupt
service routine.
– After servicing the interrupt, the
execution resumes at the saved point
of the interrupted program.
Fundamental Structures
• The CPU suspends its current
executions and services the interrupt
– An interrupt occurs, control transfers to
OS
– Locate the interrupt service routine
(ISR)
– Execute the ISR
– Return to interrupted program
Servicing the Interrupt

OS
2
1

Intp
4 3
t.
I/O Structure

• The CPU transfers the data from (or


to) the device buffers.
• After issuing an I/O operation, the
CPU continually checks or polls for its
completion
I/O Structure

I/O in progress
I/O device
I/O is completed

CPU
CPU periodically
CPU issues an I/O CPU resumes
checks for the
operation execution
completion of I/O
operation
Direct Memory Access (DMA)

• Used for high-speed I/O devices


• Device controller transfers an entire
block of data directly to or from its
own buffer storage to memory, with
no intervention by the CPU.
• While performing DMA, the CPU is
available to accomplish other work.
DMA
data data
Input Output

stores data retrieves data


Memory

request request
Input Output

stores data retrieves data


Memory
Direct Memory Access (DMA)

• For high-end systems, the switch is


used rather than bus

• Multiple components can talk to


other components concurrently,
rather than competing for cycles on a
shared bus.

• Thus, DMA is even more effective.


Storage structure and hierarchy
• Main memory – only large storage
media that the CPU can access
directly.
• Secondary Storage – extension of
main memory that provides large
non-volatile storage capacity.
– Magnetic Disks
Storage device Hierarchy
OS Operation : Dual Mode
• Sharing system resources requires
OS to ensure that an incorrect
program cannot cause other
programs to execute incorrectly.
• Provide hardware support to
differentiate between at least two
modes of operations.
– User mode: Execution is done on
behalf of the user.
– Supervisor (protected or kernel mode)
– execution is done by the OS.
Dual modes of operation
• Mode bit is added to the computer
hardware to indicate the current
mode:
– Monitor (0)
– User (1)
• When an interrupt of fault occurs
hardware switches to monitor mode
I/O protection
• All I/O instructions are privileged
instructions
• Must ensure that user program could
never gain control of the control of
the computer in monitor mode
Memory Protection
• Must provide memory protection for the
interrupt vector, interrupted service
routines, and other residing programs.
• Use of two registers - determines the
range of legal addresses of a program
access.
– Base register – holds the smallest legal
physical memory address.
– Limit register – contains the size of the
range.
• Called MMU (Memory Management
Unit) in modern systems
Memory Protection
CPU Protection
• Timer – interrupts computer after specified
period to ensure OS maintains control.
– Timer is decremented every clock tick,
– When timer reaches the value 0, an interrupt
occurs.
• Timer commonly used to implement time-
sharing
• Time also used to compute the current
time.
• Load-timer is a privileged instruction.
Example
• Process Burst time timer = 5 MS
• P1 12
• P2 5
• P3 7
How should the OS be viewed?
• By examining the services it provides

• By looking at the interface it makes


available to users and programmers

• By disassembling the system into its


components and their
interconnections.
User interface

File management

Memory Device
Process mgmt Storage mgmt
mgmt mgmt Networking

Protection mechanisms

HARDWARE
Process Management
• Process
– Program in execution; unit of work in a
system, active entity with the program
counter specifying the next instruction
to execute.
• A process needs certain resources:
– CPU time
– Memory
– Files
– I/O devices
Process Management
• Program: a passive entity while
process is an active entity.
• Single-threaded process
– Has one program counter (PC)
– Single instruction, sequential execution
• Multithreaded process
– Has multiple PC
OS Responsibilities
• Creating and deleting both user and
system processes
• Suspending and resuming the execution
of the processes.
• Mechanism for process synchronization
• Mechanism for process communication
• Mechanism for deadlock handling.
Memory Management
• OS allocate the main memory to
several processes with the aim of
making sure that a process that is
about to take control of the CPU is
already in the memory

• Memory – large array of words or bytes


each with its own address. A repository
of quickly accessible data served by the
CPU and I/O devices
OS responsibilities
• Keeping track of which parts of the
memory are currently being used
and by whom.
• Deciding which processes and data
to be loaded into memory when
memory space becomes available.
• Allocating and deallocating memory
space as needed.
Storage Management
• OS provides a uniform, logical view
of information
• OS maps files onto physical media
and accesses these files via storage
devices.
• Secondary Storage – used to backup
main memory
• Includes File-system management &
mass- storage management
A: File Systems Management
• The OS manages the organization of
the secondary storage and provides
a “file” abstraction that is convenient
to the applications running in the
system and to the computer user
File
• A logical storage unit

• Collection of related information


defined by its creator
OS Responsibility
• Creating and deleting of files
• Creating and deleting of directories
to organize files
• Supporting primitives for
manipulating files and directories.
• Mapping files onto secondary storage
• Backing up files on stable (non-
volatile) storage media.
B: Mass-Storage Management
• Proper management of disk storage
is a central importance to a
computer system.
• OS responsibilities
– Free space management
– Storage allocation
– Disk scheduling
I/O Device Management
• Usually the users do not want to
know the detail of how a particular
peripheral has to be driven in order
to read or print a character. A higher
level interface called a device driver
is provided by the OS.
• I/O system consists of:
– A buffer caching system
– A general device-driver interface
– Drivers for specific hardware devices
Media
• Has its own characteristics and
physical organization
• Controlled by a device with its own
unique characteristics like speed,
capacity, data transfer path and
access method.
Distributed systems
• The processors in the system are
connected through a communication
network.
• Communication takes place using a
protocol (Eg. TCP/IP, ATM)
Types of Networks:
• Local Area Network
– Connects computers within a room, a
floor, or a building
• Wide Area Network
– Links buildings, cities, or countries.
– Eg. Connects offices worldwide
• Metropolitan Area network
– Links buildings within a city.
Media used in Networks
• Copper wires, fiber strands
• Wireless technologies:
– Satellites
– Microwave dishes
– Radios
– Cellular communications
– IR (Infrared)
– BlueTooth, 802.11
Protection and security system
• Ensures files, memory, segments,
CPU and other resources can only be
provided on by only those processes
that have gained proper
authorization from the OS.
• Keep processes from interfering with
each other and prevent unauthorized
access by applications and users to
data and other resources.
Protection and security system
• Protection – refers to a mechanism
for controlling the access of
programs, processes or users to the
resources defined by a computer
system.
User interface
• OS provides an interface between
the user that allows high level
commands to be issued by the user.
Command line interpreter/ GUI
• Interface between the user and the
OS.

• Sometimes called GUI (Windows),


CLI (DOS) or control-card interpreter
or shell.
Command Interpreter
• Many commands are given to the OS
by control statements which deal
with:
– Process creation and management
– I/O handling
– Secondary storage management
– Main-memory management
– File-system access
– Protection
– Networking
Summary – OS components
• Process management
• Memory management
• Storage management
• I/O Management
• File systems
• Networking
• Protection and security system
• User interface
OS Services
1. Program execution – system capability
to load a program into memory and
run it.
2. I/O Operations – since user programs
cannot execute I/O operations
directly, OS must provide some means
to perform I/O
3. File-system manipulation – program
capability to read, write, create and
delete files.
OS services
4. Communications – exchange of
information between processes
executing either on the same computer
or on different systems tied together by
a network. Implemented via shared
memory or message passing
5. Error detection – ensure correct
computing by detecting errors in the
CPU and memory hardware in I/O
devices or user programs
Functions for ensuring efficient
system operations
• Resource allocation – allocating
resources to multiple users or
multiple jobs running at the same
time.
• Accounting – keep track of and
record which users use how much
and what kinds of computer
resources for account billing or for
accumulating usage statistics
Functions for ensuring efficient
system operations
• Protection – ensuring that all access
to the system resources is controlled.

• Utilities – provide utilities for the


users like date and time, accounting
utilities and debugging utilities.
Layered Operating System
MS-DOS Layer Structure
UNIX System Structure
Mac OS X Structure

You might also like