Professional Documents
Culture Documents
Os Os ST T ST T Os Os Structure Structure: Theosisabig
Os Os ST T ST T Os Os Structure Structure: Theosisabig
Os Os ST T ST T Os Os Structure Structure: Theosisabig
OS Structure
St t
COMP755 Advanced OS
System Implementation
Once written in assembly language,
operating systems are now written in
higher level languages
higher-level
Code written in a high-level language:
Can be written faster
Is more compact.
Is easier to understand and debug
COMP755
OS Structure
System Components
Process management
Memory management
File management
I/O management
Security manager
Shell
OS kernel
The kernel of the OS is that portion
providing
idi privileged
i il
d hi
high
h priority
i it ffunctions.
ti
Dispatcher
Interrupt handling
I/O control
Memory management
COMP755
OS Structure
ov
e
e
ft
h
ea
b
bo
v
he
a
COMP755
A
dd
re
ss
sp
In
te
rru
pt
p
ro
ce
ss
in
N
on
e
o
Detriments:
er
en
ce
s
1. Interrupt
processing
i
2. Address space
differences
3. All of the above
4 None of the above
4.
A
ll
of
t
Benefits:
ac
e
di
ff
OS Structure
COMP755
Shell Features
Human Interface
Popular Shells
Shell Outline
command.com in DOS
C shell in Unix
Korn shell in Unix
Borne shell in Unix
explorer.exe Windows user interface
Cygwin Unix shell for Windows
do forever {
print prompt;
read command;
if (fork()==0) { // child process
use exec() to load program;
}
wait for child process to terminate;
}
OS Structure
Simple C Program
execv function
int _execv( const char *cmdname,
const char *argv[
g [ ] );
where:
cmdname is the name of the program file.
argv is an array of pointer to strings
containing the parameters. By convention
argv[0] = cmdname; The last argv entry must
be NULL.
The execv function causes the specified
program to overlay the calling program. This
function does not return if successful.
COMP755
Redirection
Standard I/O streams can be redirected from
th command
the
d liline
ls > myfile.txt
myprog < usualstuff.txt
cc nogood.c >& allmsg.txt
OS Structure
Redirection Implementation
Multiple Processes
Shell Outline
makefile bigthing
&
xterm &
ls & cc myprog.c
do forever {
print prompt;
read command;
if (fork()==0) { // child process
use exec() to load program;
}
if (no &)
wait for child to terminate;
}
COMP755
OS Structure
Scripts
Utilities
DOS Commands
Unix Commands
attrib
cd or chdir
chkdsk
cls
copy
ctty
defrag
del or erase
deltree
dir
echo
fdisk
COMP755
find
format
help
join
label
md or mkdir
mem
more
move
rd or rmdir
ren
scandisk
set
setver
share
smartdrive
sort
sys
time and date
tree
type
xcopy
at
env
nice
cat
grep
ps
cd
head
rm
chmod
kill
rmdir
chown
lp
sort
cmp
make
tail
p
compres
man
touch
cp
mkdir
uncompress
date
more
who
du
mv
OS Structure
COMP755
od
e
U
se
rm
p
ri o
r it
yO
OS
p
r
igh
io
rit
y
od
ne
lm
K
er
Process Management
25%
Kernell mode
K
d
High priority OS
Low priority OS
User mode
1.
1
2.
3.
4.
25% 25%
Lo
Windows Utilities
Main-Memory Management
Memory is a large array of words or
bytes, each with its own address
RAM is a volatile storage device.
device It loses
its contents without power.
The operating system is responsible for
the following activities in connection with
memory management
Keep track of which parts of memory are
currently being used and by whom
Decide which processes to load when
memory space becomes available
Allocate and deallocate memory space as
needed
OS Structure
File Management
The operating system is responsible for
the following activities in connections with
file management:
File creation and deletion
Directory creation and deletion
Support of primitives for manipulating files
and directories
Mapping files onto secondary storage
Secondary-Storage Management
Since RAM is volatile and too small to
accommodate all data and programs
permanently the computer system must
permanently,
provide secondary storage to back up main
memory
Most modern computer systems use disks
as the primary on-line storage medium, for
both programs and data
The operating system is responsible for:
Free space management
Storage allocation
Disk scheduling
Security manager
The Security manager provides a
g access by
y
mechanism for controlling
programs, processes, or users to both
system and user resources
The protection mechanism must:
distinguish between authorized and
unauthorized usage
specify the controls to be imposed
provide a means of enforcement
COMP755
OS Structure
Priorities
The many different parts of the OS may
run att different
diff
t priorities
i iti
Non-process
High priority
Lower priority
User level
COMP755
OS Services
Program Execution
I/O control
Communications
Error detection
Resource allocation
Protection
Supervisor Calls
Virtual Machines
10
OS Structure
Virtual Machines
Advantages/Disadvantages
of Virtual Machines
The virtual-machine concept provides
complete protection of system resources
since each virtual machine is isolated from
all other virtual machines. This isolation,
however, permits no direct sharing of
resources.
COMP755
Non-virtual Machine
Virtual Machine
11
OS Structure
Java Environment
COMP755
12