lecture number 2 Flashcards
OS play role as resource manager
what is resource manager?
resource manager can be define as a component of OS which keep track of avalable software or HW for a system or project.
cpu?
the processor that perfome multiple computation
main memory
it stores all data which is used by cpu it is near to cpu
sytem bus
cumminacation between I/O,memory ,cpu and HW
cpu perform basisc three operation name and define
they are
1)fatch: retrive data from main memory address whos value is in PC
2)decode: decode or intrupt the fatched instruction
3)exction: excute it
mechine language
set of instruction by which cpu can talk with HW directly
it is set of binary number
instruction is sequance of bits
smallest bit is 1 bit i.e 1 or 0
word is 32 to 63 bit
instruction set of mechine languge
instruction of mechone languge
two parts
oprand = cpu register or main memory address
operator = opcode
cpu register define and two type
small chip reghister size is one cpu word
genral purpose reggister are : eax,ebx
speacial purpose : esp(stack piotern),ebp(base pionter),eip
mian memory desing and working
consist of cels each cel is made of 8 bit i.e 1 byte or multiple of it i/e 32 bit which is 4 byte
I/O and cpu refer cell address to read and write from main mem
system bus define and part
one bus control every thing
3 parts
1)data bus : carry infromation
2)address bus : decide where to put
3) control bus : which operation to use
I/O device parts and device controler define
two parts
1)device itself
2)divece controller: chip or chips that control physical deivece i.e part1
how OS or cpu write or read from I/O
they read by device controll driver which help to connect device controller and OS
deivce controller have different registers
1)status reg: tell to cpu the current status of IO
2)constroll reg : used by cpu to control IO
3)data reg : read data or write to IO
Por t- vs. Memor y-Mapped I/O
port mapped : acccess controll register using different io address space
mapped io : access controll register using same main memory address space
performing i/o task steps
polling : cpu check for status
itrupet driven : cpu get intruptfrom deice controller either it is succefull or not
programmed io : cpu works on io data
DMA : direct memory acces : here the data is attached and retrive from io deivece directly to cpu
privelged instruction and who can excute it
those instrunction which are harmful or sensitive and must be kept away from users
e.g is HLT : which stop or halt the system
INT X: which intrupt operation x
it can be exuted onlly by OS i.e in kernal mode
two user mood in cpu instruction and thier def are ?
kernal mode : it is unrestrid mode it has done by OS and in then mode os can do anything
user mode @ it is restricted here we can not do follwing thing
we can not access address of io
we can not perform senstive instruction like HLT etc
we can not change the content of main memory
can not swtich to kernal mode
how cpu knwo we are in which mode
it given by HW and it has one bit i.e 0 = kernal and 1 = user
how HW give mem protection ?
by two registers
base register @ it give the intial address
limit reg @ it give the final limit address register
so once the user porg start the os takes these two regster
and our cpu check for theese two reg refrence once the refernce is reached to limit reg so the job is finsh that is prog is end
exception and interupt diff
exception is SW gernted like deived by zero
intrupt is HW genrated
TRAP @ meaning, usage types
when we change from user to OS kernal mood so called TRAP
done by three ways
1) system calls : when the prog is runnung and we want to wite in a file in dicks so kernal moode on
2) exception call : in user mood when exceotion accour so kernal mood call to handle it
3) in user mood when intrupt accour by HW so again kernal needed to handle
user interface (user prog os interface)
it is between user prog and os but above the system calls it gve us follwing work
os procedure to excute senstive innstruction
it is written in highly level lag
it can be acces by high level langue application prog interface API rather than system calls
5 main catog of sys call ?
1) process controll
2) file manag
3) divce manag
4) info mantaince
5)communaction
process controll in sys call
it has end, abor t, load, execute, c r e a t e process, t e r m i n a t e process etc
when one stope so other must starts
file managment in sys call
in has create file, delete file, open, close, read, write etc
supported on directries and ordinary files
deivice manag in sys call
Include request device, r e l e a s e device, read, write, reposition etc
information maintaince in sys call
Include calls to get/set the time, date, system data, and process, fi l e , o r
device attributes
communaction in sys call
Include create/delete communication connection, send/receive messages,
communaction have two phase
1) massage pass
2) shared mem
discuse both breifly
1) messgae passing:
here the communatioction must gove support to sys call to idetify a process with whom we message
wait for incoming message
establish a connection bet two process
2) shared mem must give support to call
to access or creat mem that will be shared by process including threads
provide lock
provide shared mem or free up it
three methods to pass paramters in os is ?
1) put paramter inside the register but we may have more para than availble reg
2) put para in mem so the address of mem works as param
3) push into stak and popped up by os