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

os1-p1c1-computerorganization

The document provides an overview of computer system organization, focusing on the role and functions of operating systems as resource managers. It discusses key concepts such as system operation, I/O structure, storage hierarchy, and resource protection mechanisms. Additionally, it covers interrupt mechanisms, memory protection, and kernel data structures essential for efficient system management.

Uploaded by

thang.tran1002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

os1-p1c1-computerorganization

The document provides an overview of computer system organization, focusing on the role and functions of operating systems as resource managers. It discusses key concepts such as system operation, I/O structure, storage hierarchy, and resource protection mechanisms. Additionally, it covers interrupt mechanisms, memory protection, and kernel data structures essential for efficient system management.

Uploaded by

thang.tran1002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Computer system organization

Tran, Van Hoai

Faculty of Computer Science & Engineering


HCMC University of Technology

E-mail: [email protected]
(partly based on slides of Le Thanh Van)

1 / 47
Outline

1 What is operating system ?

2 Computer system organization


Computer system operation
I/O structure
Storage structure
Resource protection
Kernel data structures

2 / 47
Outline

1 What is operating system ?

2 Computer system organization


Computer system operation
I/O structure
Storage structure
Resource protection
Kernel data structures

3 / 47
Basic concepts

Operating system
= Operating + system

4 / 47
Basic concepts

Operating system
= Operating + system

Systems can be
human resources
a computer hardware organization

5 / 47
Basic concepts

Operating system
= Operating + system

Systems can be
human resources
a computer hardware organization

An operating
system?

6 / 47
OS - A manager
Abstract view

Operating system is like a perfect manager which


manages resources.

7 / 47
OS - A manager
Abstract view

Operating system is like a perfect manager which


manages resources.

Users
Operating system
Resources

8 / 47
OS - A manager
Abstract view

Operating system is like a perfect manager which


manages resources.

Users
in Computer
Operating system System

Resources

9 / 47
OS - A manager
Abstract view

Operating system is like a perfect manager which


manages resources.

Users
in Computer
Design issues
Operating system System

An OS is designed not only to “serve” users, but also to


Resources

“serve” users well in terms of


Convenience
Efficiency

10 / 47
OS - A manager
Abstract view

Operating system is like a perfect manager which


manages resources.

Users
in Computer
Design issues
Operating system System

An OS is designed not only to “serve” users, but also to


Resources

“serve” users well in terms of


Convenience
Efficiency
Example: Mobile operating system
What do users expect for a mobile operating system? (Let’s think!!!)

11 / 47
Definition
Operating system
being a basis for application programs
acting as an intermediary between the computer user and
the computer hardware

12 / 47
Definition
Operating system
being a basis for application programs
acting as an intermediary between the computer user and
the computer hardware

User view System view

13 / 47
Definition
Operating system
being a basis for application programs
acting as an intermediary between the computer user and
the computer hardware

User view System view


User view varies according
to the interface
Type of computers
influences the design
aspects
Personal computer:
easy of use > resource utilization
Computing Server:
easy of use < resource utilization
Shared Server:
easy of use ≈ resource utilization
14 / 47
Definition
Operating system
being a basis for application programs
acting as an intermediary between the computer user and
the computer hardware

User view System view


User view varies according OS as a resource allocator
to the interface or a control program to
Type of computers manage various I/O
influences the design devices and user programs
aspects OS = kernel + system
Personal computer:
easy of use > resource utilization programs
Computing Server:
easy of use < resource utilization
Shared Server:
easy of use ≈ resource utilization
15 / 47
Outline

1 What is operating system ?

2 Computer system organization


Computer system operation
I/O structure
Storage structure
Resource protection
Kernel data structures

16 / 47
Modern computer system

17 / 47
Modern computer system

1 When computer is powered up (or rebooted): bootstrap


program is an initial program (stored in ROM or
EEPROM)
1.1 to initialize all system aspects (registers, devices, ...)
1.2 to load operating system (kernel) into memory and to start executing the
system

18 / 47
Modern computer system

1 When computer is powered up (or rebooted): bootstrap


program is an initial program (stored in ROM or
EEPROM)
1.1 to initialize all system aspects (registers, devices, ...)
1.2 to load operating system (kernel) into memory and to start executing the
system

2 When being executed, kernel


2.1 to load system programs and execute them as system daemons
2.2 to wait for events

19 / 47
Event detection

More and more devices connecting to CPU: keyboard,


mouse, screen, disk drives, printer, scanner, sound card,
etc.
Device occasionally need CPU service: but can’t predict
when
Time between events should be busy time of CPU

20 / 47
Event detection

More and more devices connecting to CPU: keyboard,


mouse, screen, disk drives, printer, scanner, sound card,
etc.
Device occasionally need CPU service: but can’t predict
when
Time between events should be busy time of CPU

Need a way for CPU to find out devices requiring attention.


Attentions are detected by (i) interrupt (ii) polling

21 / 47
Event detection

More and more devices connecting to CPU: keyboard,


mouse, screen, disk drives, printer, scanner, sound card,
etc.
Device occasionally need CPU service: but can’t predict
when
Time between events should be busy time of CPU

Need a way for CPU to find out devices requiring attention.


Attentions are detected by (i) interrupt (ii) polling

Polling
“Polling is like picking up your phone every few seconds to see
if you have a call. ...”

22 / 47
Interrupt mechanism (1)

Interrupt
An event is signaled by an interrupt from
Hardware: sending a signal to CPU, thru system bus
Software: executing a special operation, called system call

23 / 47
Interrupt mechanism (1)

Interrupt
An event is signaled by an interrupt from
Hardware: sending a signal to CPU, thru system bus
Software: executing a special operation, called system call

When an interrupt occurs, a


generic routine is called to check
interrupt information. Return
address of interrupted instructions
must be stored in system stack
Then the control is transfered to
interrupt-specific handler (or
interrupt handler). An interrupt
vector keeps addresses to interrupt
handlers
24 / 47
Interrupt mechanism (2)

Interrupt timeline for a single process doing output


Programmable interrupt controller
(PIC) ∈ 8259A chip

25 / 47
Interrupt mechanism (2)

Interrupt timeline for a single process doing output


Programmable interrupt controller
(PIC) ∈ 8259A chip

Types of interrupts
Program: arithmetic overflow, division by zero, invalid memory access
Timer: CPU performs a task periodically
I/O: finish of an I/O operation, failures in I/O operation
Hardward failure: power failure, memory parity
Trap (software interrupt): a system call
26 / 47
I/O methods by interrupt

Control returns to user Control returns to user program without waiting


program only upon I/O for I/O completion
completion System call – request to the operating system to
No simultaneous I/O allow user to wait for I/O completion
processing Device-status table contains entry for each I/O
device indicating its type, address, and state
Operating system indexes into I/O device table
to determine device status and to modify table
entry to include interrupt
27 / 47
Device status table

28 / 47
Direct memory access structure

Direct memory access


Device controller transfers blocks of
data from buffer storage directly to
main memory without CPU
intervention (Source: wikipedia)

29 / 47
Direct memory access structure

Direct memory access


Device controller transfers blocks of
data from buffer storage directly to
main memory without CPU
intervention (Source: wikipedia)

Used for communication at close to memory speeds


Only interrupted per block, not per byte

30 / 47
Direct memory access structure

Direct memory access


Device controller transfers blocks of
data from buffer storage directly to
main memory without CPU
intervention (Source: wikipedia)

Used for communication at close to memory speeds


Only interrupted per block, not per byte

(Source: UCLA)

31 / 47
Storage hierarchy

“Hierarchies are celestial. In


hell all are equal.”
Nicolás Gómez Dávila

32 / 47
Storage hierarchy

Storage systems organized in hierarchy, w.r.t.


Speed
Capacity
Volatility
Cost

33 / 47
Storage hierarchy

Storage systems organized in hierarchy, w.r.t.


Speed
Capacity
Volatility
Cost

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

34 / 47
Caching

Cache
A high-speed memory to hold recently-accessed data

Caching – a mechanism of copying information into faster


storage system and it is controlled by a cache
management policy
Main memory can be viewed as a last cache for secondary
storage
Data is stored in more than one level, therefore, cache
should be kept consistent

35 / 47
Caching - Performance of various storage levels

36 / 47
How a modern computer system works

37 / 47
Hardware protection

In a multiprogrammed time-shareing system, operating system


and users share hardware and software resources
⇒ We need a way to protect an error (of a user program) not
cause problems to OS and other programs.

38 / 47
Hardware protection

In a multiprogrammed time-shareing system, operating system


and users share hardware and software resources
⇒ We need a way to protect an error (of a user program) not
cause problems to OS and other programs.
Dual-mode protection
I/O protection
Memory protection
CPU protection

39 / 47
Dual-mode protection
Execution of OS code and user-defined code must be
distinguished

40 / 47
Dual-mode protection
Execution of OS code and user-defined code must be
distinguished
There are at least 2 separate modes of operation:
User mode - execution done on behalf of a user
Kernel mode (also monitor, system, supervisor, privileged
mode) - execution done on behalf of operating system

41 / 47
Dual-mode protection
Execution of OS code and user-defined code must be
distinguished
There are at least 2 separate modes of operation:
User mode - execution done on behalf of a user
Kernel mode (also monitor, system, supervisor, privileged
mode) - execution done on behalf of operating system
Mode bit added to computer hardware to indicate the
current mode.

Privileged instructions can be issued only in kernel mode


42 / 47
I/O protection

All I/O instructions are privileged instructions


All I/O requests are done by calling system calls
Guarantee that a user program could never gain control
of the computer in kernel mode
Example: a user program that, as part of its execution, stores a new address in
the interrupt vector

43 / 47
Memory protection (1)

Must provide memory protection at


least for the interrupt vector and the
interrupt service routines
Two registers that determine the range
of legal addresses a program may
access:
Base register – holds the smallest
legal physical memory address
Limit register – contains the size of
the range
Memory outside the defined range is
protected

44 / 47
Memory protection (2)

When executing in monitor mode, the operating system


has unrestricted access to both monitor and user’s
memory
The load instructions for the base and limit registers are
privileged instructions
45 / 47
CPU protection

Timer – interrupts computer after specified period to


ensure operating system maintains control
Timer is decremented every clock tick
When timer reaches the value 0, an interrupt occurs
Timer commonly used to implement time-sharing
Load-timer is a privileged instruction

46 / 47
Kernel data structures

Singly linked list, Trees


doubly-linked list, Hash functions and Maps
circularly linked list Bitmaps
Stack, queues

47 / 47

You might also like