unit-1a
unit-1a
1
Brief History of UNIX
2
Brief History of UNIX
3
Overview of hardware
4
CPU (Processor)
5
Position of operating System
6
7
What is an Operating System?
• OS as an extended machine
• OS as a resource manager
8
Programs and Processes
9
Execution Modes
10
Architecture of UNIX
11
12
File Subsystem
• File permissions
• Device Files.
16
17
An Example of System Calls and Library Functions
- open
main( )
- opens a file
{
(preparation for read/write)
int fd, c;
-returns a fd
char buf[512], buf2[512];
-(file descriptor)
if ((fd = open(“test.txt”, O_RDONLY)) < 0) {
- read
perror(“open”);
- reads data from the file
exit(1);
specified by fd to the buffer
}
if ((c = read(fd, buf, 512)) < 0) { - close
perror(“read”); -closes the file
exit(1);
}
close(fd); - these system calls are
bcopy(buf, buf2, 512); processed in the kernel
}
- bcopy is a library function
18
19
Building Block Primitives:
I/O Redirection
ls > dout.txt
Pipes
ls | grep httpd
20
Operating System Services:
21
Assumption about hardware:
22
Interrupts and Exceptions
On interrupt :
OS saves the context of the currently executing
Process(Frozen image of process).
Determines the Sources of interrupt
24
An Example of System Calls and Library Functions
25
An Example of System Calls and Library Functions
26
Process Control Subsystem
• It schedules them to run in turn until they voluntarily relinquish the CPU
while awaiting a resource or until the kernel preempts them when their
recent run time exceeds a time quantum.
Other Modules
• Interprocess communication
– ranging from asynchronous signaling to synchronous transmission of messages
between processes.
• Hardware control:
– responsible for handling interrupts and for communicating with the machine.
– the kernel may resume execution of interrupted process after servicing an
interrupt.
– Interrupts are not serviced by special processes but by special
functions in the kernel, called in the context of the currently
running process. 28
29