16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction to kernel<br />

UNIX Internals<br />

Kernel Basics - system calls & interrupts<br />

File System - directory, regular, device files<br />

Process management - share CPU & memory<br />

Input/Output - terminal I/O<br />

Interprocess Communication IPC<br />

Kernel Basics<br />

Kernel is part of UNIX <strong>OS</strong><br />

- share CPU & memory between competing processes<br />

- processes system calls<br />

- handles peripherals<br />

- loaded into RAM on power on<br />

- runs until turned off or system crashes<br />

File management<br />

Input/Output<br />

Peripherals<br />

IPC<br />

Process management<br />

Memory management<br />

CPU + RAM<br />

Talking to Kernel<br />

Processes access kernel facilities via system call interface & peripherals communicate <strong>with</strong> kernel via hardware<br />

interrupts.<br />

Peripherals ======= KERNEL ======= Processes<br />

Hardware Interrupts System Calls<br />

System Calls<br />

- interface to kernel<br />

- open/close files<br />

- perform I/O read/write<br />

- send signals - kill<br />

- create pipes/sockets<br />

- duplicate process - fork<br />

- overlay a process - exec<br />

- terminate a process - exit<br />

- input/output<br />

- interprocess communication<br />

- process management<br />

User Mode & Kernel Mode<br />

The kernel contains data structures, which are essential to functioning of <strong>the</strong> system<br />

e.g. process table - one entry for each process<br />

open file table - one entry for each open file<br />

- reside in kernel's memory space<br />

- protected from user processes by a memory management system<br />

- system calls can directly manipulate kernel data structures<br />

- when a user process is running, it operates in a special mode called “user mode”<br />

- user mode prevents a process from executing privileged machine instructions<br />

- <strong>the</strong> only way for a user process to enter kernel mode is to execute a system call<br />

e.g.<br />

User Process<br />

user code<br />

...<br />

result = open (" file", O_RDONLY);<br />

88

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!