42
1 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 and Linux

Embed Size (px)

DESCRIPTION

Unix and Linux

Citation preview

Page 1: Unix and Linux

�1

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 "

Page 2: Unix and Linux

!2

UNIX

Multiuser, multiprogrammed"Rich libraries"Portable"POSIX

Page 3: Unix and Linux

!3

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)

Page 4: Unix and Linux

!4

Linux

The layers of a UNIX system.

UserInterface

Page 5: Unix and Linux

!5

Utility Programs

A few of the more common UNIX utility programs required by POSIX

Page 6: Unix and Linux

!6

Kernel

Approximate structure of generic kernel

Page 7: Unix and Linux

!7

Kernel

Approximate structure of Linux kernel

Page 8: Unix and Linux

!8

Processes in UNIX

Process creation in UNIX.

Page 9: Unix and Linux

!9

POSIX

The signals required by POSIX.

Page 10: Unix and Linux

!10

System Calls for Process Management

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

Page 11: Unix and Linux

!11

POSIX Shell

A highly simplified shell

Page 12: Unix and Linux

!12

Threads in POSIX

The principal POSIX thread calls.

Page 13: Unix and Linux

!13

The ls Command

Steps in executing the command ls type to the shell

Page 14: Unix and Linux

!14

Flags for Linux clone

Bits in the sharing_flags bitmap

Page 15: Unix and Linux

!15

UNIX Scheduler

The UNIX scheduler is based on a multilevel queue structure

Page 16: Unix and Linux

!16

Linux Scheduler

• Real-time FIFO"• Real-time round robin"• Timesharing"

Page 17: Unix and Linux

!17

Booting UNIX

The sequences of processes used to boot some systems

cp

Page 18: Unix and Linux

!18

Handling Memory

• Process A's virtual address space"• Physical memory"• Process B's virtual address space

Process A Process B

Page 19: Unix and Linux

!19

Sharing FilesTwo processes can share a mapped file.

A new file mapped simultaneously into two processes

Page 20: Unix and Linux

!20

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

Page 21: Unix and Linux

!21

Paging in Linux (1)

Linux uses four-level page tables

Page 22: Unix and Linux

!22

Paging in Linux (2)

Operation of the buddy algorithm.

Buddy algorithm

Page 23: Unix and Linux

!23

Networking

Use of sockets for networking

Page 24: Unix and Linux

!24

Terminal Management

The main POSIX calls for managing the terminal

Page 25: Unix and Linux

!25

I/O (1)

Some of the fields of a typical cdevsw table

Page 26: Unix and Linux

!26

I/O (2)

The Linux I/O system

Page 27: Unix and Linux

!27

The UNIX File System (1)

Some important directories found in most UNIX systems

Page 28: Unix and Linux

!28

The UNIX File System (2)

• Before linking."• After linking.

(a) Before linking. (b) After linking

Page 29: Unix and Linux

!29

The UNIX File System (3)

• Separate file systems"• After mounting

(a) (b)

(a) Before mounting. (b) After mounting

Page 30: Unix and Linux

!30

Locking Files

(a) File with one lock"(b) Addition of a second lock"(c) A third lock

Page 31: Unix and Linux

!31

System Calls for File Management

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

Page 32: Unix and Linux

!32

The lstat System Call

Fields returned by the lstat system call.

Page 33: Unix and Linux

!33

System Calls for Directory Management

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

Page 34: Unix and Linux

!34

File System

Disk layout in classical UNIX systems

Page 35: Unix and Linux

!35

File System

Directory entry fields.

Structure of the i-node

Page 36: Unix and Linux

!36

File System

The relation between the file descriptor table, the open file description

Page 37: Unix and Linux

!37

The Linux File System

Layout of the Linux Ex2 file system.

Page 38: Unix and Linux

!38

File System

• A Linux directory with three files"• The same directory after the file voluminous has been

removed

Page 39: Unix and Linux

!39

Network File System (1)

• Examples of remote mounted file systems"• Directories are shown as squares, files as circles

Page 40: Unix and Linux

!40

Network File System (2)

The NFS layer structure.

The NFS layer structure

Page 41: Unix and Linux

!41

Security in UNIX

Some examples of file protection modes

Page 42: Unix and Linux

!42

System Calls for File Protection

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