Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Part -2
Computer Startup
bootstrap program is loaded at power-up or reboot
Computer-System Operation
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
Device controller informs CPU that it has finished its operation by
causing an interrupt
through the interrupt vector, which contains the addresses of all the
service routines
instruction
Interrupt Handling
The operating system preserves the state of the CPU by storing
polling
Interrupt Timeline
I/O Structure
After I/O starts, control returns to user program only upon I/O
completion
Wait instruction idles the CPU until the next interrupt
Wait loop (contention for memory access)
At most one I/O request is outstanding at a time, no
simultaneous I/O processing
After I/O starts, control returns to user program without waiting for
I/O completion
System call request to the OS to allow user to wait for I/O
completion
Device-status table contains entry for each I/O device indicating
its type, address, and state
OS indexes into I/O device table to determine device status and
to modify table entry to include interrupt
memory speeds
Only one interrupt is generated per block, rather than the one interrupt
per byte
Storage Structure
Main memory only large storage media that the CPU can access
directly
Random access
Typically volatile
recording material
Various technologies
Storage Hierarchy
Storage systems organized in hierarchy
Speed
Cost
Volatility
Storage-Device Hierarchy
Caching
Important principle, performed at many levels in a computer (in
there
Computer-System Architecture
Most systems use a single general-purpose processor (PDAs through
mainframes)
Advantages include:
1.
Increased throughput
2.
Economy of scale
3.
Two types:
1.
Asymmetric Multiprocessing
2.
Symmetric Multiprocessing
A Dual-Core Design
UMA and NUMA
architecture variations
If processes dont fit in memory, swapping moves them in and out to run
Operating-System Operations
Process Management
A process is a program in execution. It is a unit of work within the
Memory Management
All data in memory before and after processing
All instructions in memory in order to execute
Memory management determines what is in memory when
Deciding which processes (or parts thereof) and data to move into
and out of memory
Storage Management
OS provides uniform, logical view of information storage
File-System management
Mass-Storage Management
Usually disks used to store data that does not fit in main memory or
algorithms
OS activities
Free-space management
Storage allocation
Disk scheduling
implicit
hardware such that all CPUs have the most recent value in their cache
I/O Subsystem
One purpose of OS is to hide peculiarities of hardware devices from
the user
do what
User identities (user IDs, security IDs) include name and
associated number, one per user
User ID then associated with all files, processes of that user to
determine access control
Group identifier (group ID) allows set of users to be defined and
controls managed, then also associated with each process, file
Privilege escalation allows user to change to effective ID with
more rights
Balanced
binary
search tree is O(lg n)
<linux/list.h>, <linux/kfifo.h>,
<linux/rbtree.h>
Emulation used when source CPU type different from target type (i.e.
exploration or compatibility
VMM can run natively, in which case they are also the host
Many types
Use expanding
(DRM) movement
Repeat
Power Consumption
http://www.intel.com/pressroom/kits/core2duo/pdf/epi-trends-final2.pdf
2005:
2007:
Today:
8GB (@1333MHz)
= $44.99
Disk cost:
e.g., GUI
Md. Shamsujjoha
http://www.embeddedstar.com/articles/2005/2/article20050207-4.html
Until very recently, Intel-based PCs still lacked support for 64-bit
addressing (which has been available for a decade on other platforms:
MIPS, Alpha, IBM, etc)
memory protection
privileged instructions
virtualization architectures
Intel: http://www.intel.com/technology/itj/2006/v10i3/1-hardware/7architecture-usage.htm
AMD: http://sites.amd.com/us/business/it-solutions/usagemodels/virtualization/Pages/amd-v.aspx
Privileged instructions
some instructions are restricted to the OS
why?
why?
why?
OS protection
So how does the processor know if a privileged instruction should be
executed?
e.g., how can you write to a disk if you cant execute an I/O instructions?
User programs must call an OS procedure that is, get the OS to do it for
them
Syscall instruction
user mode
kernel mode
trap handler
PC = saved PC
Enter user mode
ERET instruction
system calls?
Terminology:
Privileged instructions and resources are the basis for most everything:
memory protection, protected I/O, limiting user resource consumption,
Memory protection
OS must protect user programs from each other
maliciousness, ineptitude
Prog A
Prog B
Prog C
base reg
limit reg
I/O control
Issues:
memory-mapped I/O
polling
Interrupts
Asynchronous I/O
Interrupts are the basis for asynchronous I/O
Timers
How can the OS prevent runaway user programs from hogging the CPU
(infinite loops?)
before it transfers to a user program, the OS loads the timer with a time
to interrupt
Synchronization
Interrupts cause a wrinkle:
may occur any time, causing code to execute that interferes with code
that was interrupted
OS must be able to synchronize concurrent processes
Synchronization:
guarantee that short instruction sequences (e.g., read-modify-write)
execute atomically
one method: turn off interrupts before the sequence, execute it, then reenable interrupts
architecture must support disabling interrupts
Privileged???
another method: have special complex atomic instructions
read-modify-write
test-and-set
load-linked store-conditional
Concurrent programming
Management of concurrency and asynchronous events is biggest difference
looking for new ways to use transistors to make their chips more
desirable
1/29/17
81
Some questions
Why wouldnt you want a user program to be able to access an I/O device