You are on page 1of 42

UNIX and LINUX

History of UNIX and Linux "


Overview of Linux "
Processes in Linux "
Memory management in Linux "
Input/output in Linux "
The Linux file system "
Security in Linux "

UNIX
Multiuser, multiprogrammed"
Rich libraries"
Portable"
POSIX

!2

History
1971. Unix Version 1, Ken Thompson"
1973. ported to C"
1979. AT&T Unix V7"
1980. BSD 4.0"
1983. AT&T - Unix System V"
1985. BSD 4.3"
1989. AT&T - Unix System V R4.0"
1991. Linux 0.01 (9.3k lines C, 950 lines assembly)"
1994. Linux 2.0 (165k lines)

!3

Linux
User
Interface

The layers of a UNIX system.

!4

Utility Programs

A few of the more common UNIX utility


programs required by POSIX
!5

Kernel

Approximate structure of generic kernel


!6

Kernel

Approximate structure of Linux kernel


!7

Processes in UNIX

Process creation in UNIX.

!8

POSIX

The signals required by POSIX.

!9

System Calls for Process Management

s is an error code"
pid is a process ID"
residual is the remaining time from the previous alarm

!10

POSIX Shell

A highly simplified shell


!11

Threads in POSIX

The principal POSIX thread calls.

!12

The ls Command

Steps in executing the command ls type to the shell


!13

Flags for Linux clone

Bits in the sharing_flags bitmap

!14

UNIX Scheduler

The UNIX scheduler is based on a multilevel queue structur


!15

Linux Scheduler
Real-time FIFO"
Real-time round robin"
Timesharing
"

!16

Booting UNIX

cp

The sequences of processes used to boot some systems


!17

Handling Memory
Process A

Process B

Process A's virtual address space"


Physical memory"
Process B's virtual address space

!18

Sharing Files
Two processes can share a mapped file.

A new file mapped simultaneously into two processes


!19

System Calls for Memory Management

s is an error code"
b and addr are memory addresses"
len is a length"
prot controls protection"
flags are miscellaneous bits"
fd is a file descriptor"
offset is a file offset
!20

Paging in Linux (1)

Linux uses four-level page tables


!21

Paging in Linux (2)

Operation of the buddy algorithm.

Buddy algorithm
!22

Networking

Use of sockets for networking


!23

Terminal Management

The main POSIX calls for managing the terminal


!24

I/O (1)

Some of the fields of a typical cdevsw table


!25

I/O (2)

The Linux I/O system


!26

The UNIX File System (1)

Some important directories found in most UNIX systems


!27

The UNIX File System (2)

Before linking."
After linking.

(a) Before linking. (b) After linking


!28

The UNIX File System (3)

Separate file systems"


After mounting

(a)

(a) Before mounting.

(b)

(b) After mounting


!29

Locking Files

(a) File with one lock"


(b) Addition of a second lock"
(c) A third lock
!30

System Calls for File Management

s is an error code"
fd is a file descriptor"
position is a file offset
!31

The lstat System Call

Fields returned by the lstat system call.


!32

System Calls for Directory Management

s is an error code"
dir identifies a directory stream"
dirent is a directory entry
!33

File System

Disk layout in classical UNIX systems

!34

File System

Directory entry fields.

Structure of the i-node


!35

File System

The relation between the file descriptor table,


the open file description
!36

The Linux File System

Layout of the Linux Ex2 file system.


!37

File System

A Linux directory with three files"


The same directory after the file voluminous has been
removed
!38

Network File System (1)

Examples of remote mounted file systems"


Directories are shown as squares, files as circles

!39

Network File System (2)

The NFS layer structure.

The NFS layer structure


!40

Security in UNIX

Some examples of file protection modes


!41

System Calls for File Protection

s is an error code"
uid and gid are the UID and GID, respectively
!42

You might also like