Escolar Documentos
Profissional Documentos
Cultura Documentos
Computer
hardware is a
physical
components of
the computer.
Software is a
general term for
the various kinds of
programs used to
operate computers
and related
devices. (The term
hardware describes
the physical
aspects of
computers and
related devices.)
Chapter1
interrupts
Processor
Cache
Memory - I/O Bus
Main
Memory
I/O
Controller
Disk
Disk
I/O
Controller
I/O
Controller
Graphics
Network
Le
ctu
Sir Kashif
Chapter1
Chapter1
Chapter1
10
11
Job3
Job2
Memory
partitions
Job1
Operating
system
Operating system
protected from each job
as well
Resources (time,
hardware) split between
jobs
Still not interactive
User submits job
Computer runs it
User gets results minutes
(hours, days) later
Chapter1
12
Chapter1
13
14
Chapter1
15
Outside
world
Video
controller
CPU
Memory
Harddrive
controller
USB
controller
Network
controller
Computerinternals
(insidethebox)
Chapter1
16
Fetch
unit
Fetch
unit
Decode
unit
Decode
unit
Execute
unit
Buffer
Fetch
unit
PipelinedCPU
Execute
unit
Decode
unit
Execute
unit
Execute
unit
SuperscalarCPU
Chapter1
17
Capacity
Better
Access latency
< 1 KB
Registers
1 ns
1 MB
Cache (SRAM)
25 ns
256 MB
50 ns
40 GB
Magnetic disk
5 ms
> 1 TB
Magnetic tape
50 sec
Better
18
Data in concentric
tracks
Tracks broken into sectors
head
sector
platter
track
cylinder
Cylinder: corresponding
tracks on all surfaces
surfaces
spindle
actuator
Chapter1
19
Address
0x2ffff
0x2b000
0x27fff
0x23000
Address
0x2ffff
0x2d000
Userdata
Limit
0x2bfff
0x29000
Userdata
Base
0x24fff
Userprogram
0x23000
Userprogram
anddata
Userprogram
anddata
0x1dfff
Limit1
Base1
0x1dfff
Operating
system
0
Limit2
Base2
Operating
system
0
20
3
5 Interrupt
controller
6
CPU
1
Disk
controller
4
1:Interrupt
Instructionn
Instructionn+1
Operating
system
Interrupthandler
3:Return
2:Processinterrupt
21
Chapter1
22
A
B
Process: program in
execution
23
0x7fffffff
Stack
Stack
Automatic variables
Procedure call
information
Data
Data
Text
0
24
Keeptrackofwhichpartsofmemoryarecurrentlybeingusedandbywhom.
Decidewhichprocessesaretobeloadedintomemorywhenmemoryspacebecome
savailable.
Allocateanddeallocatememoryspaceasneeded.
Chapter1
25
Potentialdeadlock
Actualdeadlock
Chapter1
26
Rootdirectory
cse
bin
faculty
ls
ps
cp
csh
elm
classes
stuff
grads
sbrandt
kag
amer4
research
stuff
Chapter1
27
Chapter1
28
Chapter1
29
0xffffffff
Library
(readcall)
read(fd,buffer,length)
Returntocaller
Traptokernel
3 Trapcodeinregister
User
space
4
Kernel
space
(OS)
IncrementSP
Callread
1 Pusharguments
Dispatch
0
6 Syscall
handler
User
code
System call:
Program pushes
arguments, calls
library
Library sets up trap,
calls OS
OS handles system
call
Control returns to
library
Library returns to user
program
Chapter1
30
Call
Description
fd = open(name,how)
Openafileforreadingand/orwriting
s = close(fd)
Closeanopenfile
n = read(fd,buffer,size)
Readdatafromafileintoabuffer
n = write(fd,buffer,size)
Writedatafromabufferintoafile
s = lseek(fd,offset,whence)
Movethecurrentpointerforafile
s = stat(name,&buffer)
Getafilesstatusinformation(inbuffer)
s = mkdir(name,mode)
Createanewdirectory
s = rmdir(name)
Removeadirectory(mustbeempty)
s = link(name1,name2)
Createanewentry(name2)thatpointstothe
sameobjectasname1
s = unlink(name)
Removenameasalinktoanobject(deletes
theobjectifnamewastheonlylinktoit)
Chapter1
31
Call
Description
pid = fork()
Createachildprocessidenticaltothe
parent
pid=waitpid(pid,&statloc,options)
Waitforachildtoterminate
s = execve(name,argv,environp)
Replaceaprocesscoreimage
exit(status)
Terminateprocessexecutionandreturn
status
s = chdir(dirname)
Changetheworkingdirectory
s = chmod(name,mode)
Changeafilesprotectionbits
s = kill(pid,signal)
Sendasignaltoaprocess
seconds = time(&seconds)
Gettheelapsedtimesince1Jan1970
Chapter1
32
while (TRUE) {
/* repeat forever */
type_prompt( );
/* display prompt */
read_command (command, parameters) /* input from terminal */
if (fork() != 0) {
/* fork off child process */
/* Parent code */
waitpid( -1, &status, 0); /* wait for child to exit */
} else {
/* Child code */
execve (command, parameters, 0);
/* execute command */
}
}
Chapter1
33
Main
procedure
Service
routines
Utility
routines
Chapter1
34
Linux
Windows NT
FreeBSD
VMware
VMware
VMware
Linux
Bare hardware
35
Client
process
Client
process
Process
server
Terminal
server
Microkernel
File
server
Memory
server
Usermode
Kernelmode
36
Number
Exp.
Prefix
Exp.
Number
Prefix
103
0.001
milli
103
1,000
106
0.000001
micro
106
1,000,000
109
0.000000001
nano
109
1,000,000,000
Giga
1012
0.000000000001
pico
1012
1,000,000,000,000
Tera
1015
0.000000000000001
femto
1015
1,000,000,000,000,000
Peta
1018
0.000000000000000001
atto
1018
1,000,000,000,000,000,000
Exa
Chapter1
Kilo
Mega
37
Bubble sort, also known as sinking sort, is a simple sorting algorithm that
worksbyrepeatedlysteppingthroughthelisttobesorted,comparingeachpair
ofadjacentitemsandswappingthemiftheyareinthewrongorder.
A bubble sort, a sorting algorithm that continuously steps through a list,
swappingitemsuntiltheyappearinthecorrectorder.