SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
1
KUMO B4 shuya
Ritchie, O. M., and Ken Thompson. “The UNIX time-sharing system.”
The Bell System Technical Journal 57.6 (1978): 1905-1929.
2
UNIX is general-purpose, multi-user, interactive OS
A hierarchical file system incorporating demountable volumes

Compatible file, device, and inter-process I/O

The ability to initiate asynchro- nous processes 

System command language select- able on a per-user basis 

Over 100 subsystems including a dozen languages
3
UNIX the system are simple, elegance, ease of use
First UNIX is installed on DEC PDP-11/40 computer

Powerful operating system for interactive use

Not expensive either in equipment ($4,000) or in human effort

These programs are available under UNIX

- assembler, text editor, link loader, compiler…

All UNIX software is maintained under UNIX PDP-11/40
http://webpages.charter.net/thecomputercollection/pdp11/pdp1140.jpg
4
PDP-11/45 UNIX installed Computer

- 16-bit word (8-bit byte) computer, Core memory 144K bytes

- UNIX occupies 42K bytes

UNIX occupies 42K bytes

The minimum configuration require 50K bytes of core
The minimal system capable of running the software
5
The size of UNIX written in C is one third greater than old one

which written in assembly.

New system is not only easier to understand and to modify

but also many functional improvements

- multiprogramming, can share reentrant code
UNIX software is written in C language
6
Ordinary Files
- A file contains whatever information the user places on it

Directories
- Files for managing regular files and special files

Special Files
- Treat peripheral devices as virtual files
UNIX has three file system
7
Ordinary Files
A file contains whatever information the user places on it

Ex. -> symbolic or binary programs

System don’t expect file structure.

Structure of files is controlled by programs not by system
8
Directories
It provide mapping between file names and themselves

Each user has a directory of his own files and 

can create subdirectories

Several directories is maintained by system for its own use

- root - all files can be found by tracing a path through

Files are named by sequence of 14 fewer characters
9
Directories
Directory names are separated by slash “/”

- If the sequence begin with slash, search begin in “root”

- Not starting with slash, search begin in current directory

The name “.” in each directory refers to directory itself

The name “..” in each directory refers to its parent

Same nondirectory file may appear in several directories

which called linking
10
“root” is stored on same device but it is not necessary that

the entire file system hierarchy reside on this device

Mount replaces a leaf of the hierarchy tree by new subtree

After the mount, there is virtually no distinction between files

on the removable volume and parent file system

No link may exist between one file system hierarchy and 

another
11
Access control scheme in UNIX is quite simple
Each user is assigned a unique user ID number

When a file is created, it is marked with ID of its owner

Also given for new files is set of seven protection bits

Privileged programs are not accessed by other users

The system recognizes “super-user” as except from the usual

constraints on file access
12
System calls todo I/O of UNIX is quite simple
filep = open (name, flag)
- filep is called file descriptor which is used to identify to
read, write, manipulate

- name indicates the name of the file 

- flag indicates file status such as read, write

location = seek (filep, base, offset)
- offset indicates starting points and base indicates
destination
13
System calls todo I/O of UNIX is quite simple
n = read (filep, buffer, count)
n = write (filep, buffer, count)
- n is the number of bytes transmitted

- buffer is is specified byte array

- count is number of bytes to receive / send

write case, n is the same as count
read case, n is less than count when read call returns equal to
zero it indicates the end of the file
14
Data structure of UNIX file system
Directory entry contains only a name for the associated file

and pointer which integer is called “i-number” (index number)

“i-list” stored the device on which the directory resides 

when the file is accessed

“i-node” contains the description of the file as follow

- owner, protection, address, size, last modification …
15
An image is a computer excitation environment

- An image is current state of pseudo computer

- core image, general register values, status of files ...

An process is the execution of an image

- During processing, image resides in core

An image is divided into [text, data, stack] segments

- Machine instruction is placed in text segment
- Data (variables on heap) is placed in data segment
- Stack segment is place for stack, auto variables placed in
16
New process is presented by only by fork system call
processid = fork (label)
When fork is executed by a process, it spills into two process 

- parent, control returns directly from fork

- child, control is passed to location label

The processid is the identification of the other program
fork may determine whether process is the parent or child
17
pipe is used for interprocess communication
filep = pipe ( )
- It returns filep and creates interprocess channel called pipe
- pipe is passed from parent to child process in the image

by the fork call

- One pipe returns two file descriptor (for read and write)
18
Requests the system to read in and execute program
execute (file, arg1, arg2, …, argn)
- arg1 is the same string as file, so that program may
determine the name by which it was invoked

- All the code and data in the process using excuse is
replaced from file
19
processid = wait ( )
- wait suspend execution until its children has completed
execution

- It returns the processid of the terminated process

exit (status)
- exit terminates a process, destroy its image, close its files

- Process may also terminate as result of various illegal
actions or user-granted signals
20
When communicate UNIX, the Shell is helpful
The shell is command line interpreter

command arg1, arg2, …, argn
- Command line consist of command name and arguments

- The command name and arguments separated by spaces

The site of command
- Directory /bin contains all the commands generally used

- Path of command may be including “/” character to specify
21
No special coding is needed handling I/O redirection
The shell start with two files which have file descriptor 0, 1

- 0 is for reading, programs read massages typed by users

- 1 is for writing, understood as the standard output

The shell can change standard assignments of file descriptor

The file name following “<” and “>” are called redirect

- “<” means place out put 

- “>” take input followed arguments
22
Example of Standard I/O use
$ ls >there
- Create a file called “there” and places the listing

$ ed <script
- It interprets script as a file of editor command
Execution Example
23
Filter copies standard input to its standard output
A sequence of commands separated by vertical vars causes
to execute simultaneously and standard out put of each
commands is delivered to the next commands.

$ cat /var/log/secure | grep sudo > sudo_result
- $ cat /var/log/secure > temp1

- $ grep sudo < temp1 > temp2

- $ sudo_result < temp2
Example
Divided…
24
The shell is itself a command
$ ls; ed
- With semicolon when ls ends, ed is executed

$ as source >output &
- Assembling source and diagnostic output going to output
$ as source >output & ls >files &
- Both assembly and listing in the background
$ (date; ls) >x &
- Print current date followed by listing output going to x
25
Sequential use of commands
$ as source

$ mv a.out testprog

$ testprog

as assembles code and output a.out (binary)

mv causes a.out to be renamed testprog

testprog executes itself

$ sh <tryout

sh to excute the commands sequentially
26
Waiting
read return
Analyze
command
line
fork called
How to work the Shell
The new-line character

ending the line is typed
Putting the arguments

in a form for execute
fork childfork parent
wait
exec
exit
Die process
2727
When a process is created by the fork primitive

- It inherits the core image, all open files in parents with file
descriptor

- Its child process automatically inherits file descriptor value

When a n argument with “<” or “>” is given

- Offspring process, before it execute, makes the standard 

I/O file descriptor 0 or 1 respectively refer to the named file

Terminate point

- Discovering an end of file, the Shell terminates
28
init creates one process for each typewriter channel
The last step in the initialization of UNIX is the creation of a 

single process and invocation of a program called init.

When init was invoked there were no files open, in each 

process I/O devices will receive 0 or 1 file descriptor.

When user typed correct login name and password, init will 

wake up and change the user’s default current directory.

Logout need only type the end of the file sequence.
29
Faults cause the processor to trap to a system routine
Faults are such as..

- Referring nonsexist memory, unimplemented instruction…

When an illegal action is caught, the system terminates the 

process and writes the user’s image on file core

A debugger can be used to determine faults

“deletes” is interrupt signal which simply cease execution

quit signal is also used to force a core image to be produced
30
Three consideration influenced the design of UNIX
❶ From programmers perspective…

- Interactive system is much more productive and satisfying to 

use than a “batch” system

❷ Severe regulation of system an d its software

- The size constraint made economy and elegance of design.

❸ UNIX is able to maintain themselves

- Programs are always available and modified online, we were 

willing to rewrite the system when new idea were invented

Contenu connexe

Tendances

Tendances (20)

File System Implementation - Part1
File System Implementation - Part1File System Implementation - Part1
File System Implementation - Part1
 
RPM (LINUX)
RPM (LINUX)RPM (LINUX)
RPM (LINUX)
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
 
Hard Disk Encryptions
Hard Disk EncryptionsHard Disk Encryptions
Hard Disk Encryptions
 
Backup
BackupBackup
Backup
 
Cloud computing notes
Cloud computing notesCloud computing notes
Cloud computing notes
 
Kali presentation
Kali presentationKali presentation
Kali presentation
 
Security in distributed systems
Security in distributed systems Security in distributed systems
Security in distributed systems
 
101 Basic concepts of information security
101 Basic concepts of information security101 Basic concepts of information security
101 Basic concepts of information security
 
Kernels and its types
Kernels and its typesKernels and its types
Kernels and its types
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linux
 
Secondary storage structure
Secondary storage structureSecondary storage structure
Secondary storage structure
 
Distributed Systems Naming
Distributed Systems NamingDistributed Systems Naming
Distributed Systems Naming
 
File sharing
File sharingFile sharing
File sharing
 
Information Security Lesson 2 - Attackers and Attacks - Eric Vanderburg
Information Security Lesson 2 - Attackers and Attacks - Eric VanderburgInformation Security Lesson 2 - Attackers and Attacks - Eric Vanderburg
Information Security Lesson 2 - Attackers and Attacks - Eric Vanderburg
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Process management
Process managementProcess management
Process management
 
Virtualization and cloud Computing
Virtualization and cloud ComputingVirtualization and cloud Computing
Virtualization and cloud Computing
 

Similaire à Summarized of UNIX Time Sharing System

Operating system
Operating systemOperating system
Operating system
HarshithaAllu
 
Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)
hildenjohannes
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
Sudharsan S
 

Similaire à Summarized of UNIX Time Sharing System (20)

Systemcall1
Systemcall1Systemcall1
Systemcall1
 
Linux Notes-1.pdf
Linux Notes-1.pdfLinux Notes-1.pdf
Linux Notes-1.pdf
 
Basics of Linux Commands, Git and Github
Basics of Linux Commands, Git and GithubBasics of Linux Commands, Git and Github
Basics of Linux Commands, Git and Github
 
Linux 系統程式--第一章 i/o 函式
Linux 系統程式--第一章 i/o 函式Linux 系統程式--第一章 i/o 函式
Linux 系統程式--第一章 i/o 函式
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
84640411 study-of-unix-os
84640411 study-of-unix-os84640411 study-of-unix-os
84640411 study-of-unix-os
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Basics of unix
Basics of unixBasics of unix
Basics of unix
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure
 
Operating system
Operating systemOperating system
Operating system
 
Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)
 
Prog i
Prog iProg i
Prog i
 
Introduction to unix
Introduction to unixIntroduction to unix
Introduction to unix
 
Unix
UnixUnix
Unix
 
Linux
LinuxLinux
Linux
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
App A
App AApp A
App A
 

Plus de Shuya Osaki

Plus de Shuya Osaki (15)

第2章 プロトコル
第2章 プロトコル第2章 プロトコル
第2章 プロトコル
 
公的個人認証サービスを用いたスマートエスクロー
公的個人認証サービスを用いたスマートエスクロー公的個人認証サービスを用いたスマートエスクロー
公的個人認証サービスを用いたスマートエスクロー
 
学部紹介セミナー[森村学園高等部]
学部紹介セミナー[森村学園高等部]学部紹介セミナー[森村学園高等部]
学部紹介セミナー[森村学園高等部]
 
OSTEP Chapter2 Introduction
OSTEP Chapter2 IntroductionOSTEP Chapter2 Introduction
OSTEP Chapter2 Introduction
 
マスタリングTCP/IP 入門編 1章
マスタリングTCP/IP 入門編 1章マスタリングTCP/IP 入門編 1章
マスタリングTCP/IP 入門編 1章
 
Nand2 tetris 1and2
Nand2 tetris 1and2Nand2 tetris 1and2
Nand2 tetris 1and2
 
RG_LT大会_SFCで車通学をする
RG_LT大会_SFCで車通学をするRG_LT大会_SFCで車通学をする
RG_LT大会_SFCで車通学をする
 
RG講義_SSH
RG講義_SSHRG講義_SSH
RG講義_SSH
 
Primer to Browser Netwroking
Primer to Browser NetwrokingPrimer to Browser Netwroking
Primer to Browser Netwroking
 
How to Upload File in SFC.
How to Upload File in SFC.How to Upload File in SFC.
How to Upload File in SFC.
 
How to Use Email in SFC.
How to Use Email in SFC.How to Use Email in SFC.
How to Use Email in SFC.
 
自動運転の概要
自動運転の概要自動運転の概要
自動運転の概要
 
Introduction to QUIC
Introduction to QUICIntroduction to QUIC
Introduction to QUIC
 
ハイパフォーマンスブラウザネットワーキング2
ハイパフォーマンスブラウザネットワーキング2ハイパフォーマンスブラウザネットワーキング2
ハイパフォーマンスブラウザネットワーキング2
 
ハイパフォーマンスブラウザネットワーキング1
ハイパフォーマンスブラウザネットワーキング1ハイパフォーマンスブラウザネットワーキング1
ハイパフォーマンスブラウザネットワーキング1
 

Dernier

valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 

Summarized of UNIX Time Sharing System

  • 1. 1 KUMO B4 shuya Ritchie, O. M., and Ken Thompson. “The UNIX time-sharing system.” The Bell System Technical Journal 57.6 (1978): 1905-1929.
  • 2. 2 UNIX is general-purpose, multi-user, interactive OS A hierarchical file system incorporating demountable volumes Compatible file, device, and inter-process I/O The ability to initiate asynchro- nous processes System command language select- able on a per-user basis Over 100 subsystems including a dozen languages
  • 3. 3 UNIX the system are simple, elegance, ease of use First UNIX is installed on DEC PDP-11/40 computer Powerful operating system for interactive use Not expensive either in equipment ($4,000) or in human effort These programs are available under UNIX - assembler, text editor, link loader, compiler… All UNIX software is maintained under UNIX PDP-11/40 http://webpages.charter.net/thecomputercollection/pdp11/pdp1140.jpg
  • 4. 4 PDP-11/45 UNIX installed Computer - 16-bit word (8-bit byte) computer, Core memory 144K bytes - UNIX occupies 42K bytes UNIX occupies 42K bytes The minimum configuration require 50K bytes of core The minimal system capable of running the software
  • 5. 5 The size of UNIX written in C is one third greater than old one
 which written in assembly. New system is not only easier to understand and to modify
 but also many functional improvements - multiprogramming, can share reentrant code UNIX software is written in C language
  • 6. 6 Ordinary Files - A file contains whatever information the user places on it Directories - Files for managing regular files and special files Special Files - Treat peripheral devices as virtual files UNIX has three file system
  • 7. 7 Ordinary Files A file contains whatever information the user places on it Ex. -> symbolic or binary programs System don’t expect file structure. Structure of files is controlled by programs not by system
  • 8. 8 Directories It provide mapping between file names and themselves Each user has a directory of his own files and 
 can create subdirectories Several directories is maintained by system for its own use - root - all files can be found by tracing a path through Files are named by sequence of 14 fewer characters
  • 9. 9 Directories Directory names are separated by slash “/” - If the sequence begin with slash, search begin in “root” - Not starting with slash, search begin in current directory The name “.” in each directory refers to directory itself The name “..” in each directory refers to its parent Same nondirectory file may appear in several directories
 which called linking
  • 10. 10 “root” is stored on same device but it is not necessary that
 the entire file system hierarchy reside on this device Mount replaces a leaf of the hierarchy tree by new subtree After the mount, there is virtually no distinction between files
 on the removable volume and parent file system No link may exist between one file system hierarchy and 
 another
  • 11. 11 Access control scheme in UNIX is quite simple Each user is assigned a unique user ID number When a file is created, it is marked with ID of its owner Also given for new files is set of seven protection bits Privileged programs are not accessed by other users The system recognizes “super-user” as except from the usual
 constraints on file access
  • 12. 12 System calls todo I/O of UNIX is quite simple filep = open (name, flag) - filep is called file descriptor which is used to identify to read, write, manipulate - name indicates the name of the file - flag indicates file status such as read, write location = seek (filep, base, offset) - offset indicates starting points and base indicates destination
  • 13. 13 System calls todo I/O of UNIX is quite simple n = read (filep, buffer, count) n = write (filep, buffer, count) - n is the number of bytes transmitted - buffer is is specified byte array - count is number of bytes to receive / send write case, n is the same as count read case, n is less than count when read call returns equal to zero it indicates the end of the file
  • 14. 14 Data structure of UNIX file system Directory entry contains only a name for the associated file
 and pointer which integer is called “i-number” (index number) “i-list” stored the device on which the directory resides 
 when the file is accessed “i-node” contains the description of the file as follow - owner, protection, address, size, last modification …
  • 15. 15 An image is a computer excitation environment - An image is current state of pseudo computer - core image, general register values, status of files ... An process is the execution of an image - During processing, image resides in core An image is divided into [text, data, stack] segments - Machine instruction is placed in text segment - Data (variables on heap) is placed in data segment - Stack segment is place for stack, auto variables placed in
  • 16. 16 New process is presented by only by fork system call processid = fork (label) When fork is executed by a process, it spills into two process - parent, control returns directly from fork - child, control is passed to location label The processid is the identification of the other program fork may determine whether process is the parent or child
  • 17. 17 pipe is used for interprocess communication filep = pipe ( ) - It returns filep and creates interprocess channel called pipe - pipe is passed from parent to child process in the image
 by the fork call - One pipe returns two file descriptor (for read and write)
  • 18. 18 Requests the system to read in and execute program execute (file, arg1, arg2, …, argn) - arg1 is the same string as file, so that program may determine the name by which it was invoked - All the code and data in the process using excuse is replaced from file
  • 19. 19 processid = wait ( ) - wait suspend execution until its children has completed execution - It returns the processid of the terminated process exit (status) - exit terminates a process, destroy its image, close its files - Process may also terminate as result of various illegal actions or user-granted signals
  • 20. 20 When communicate UNIX, the Shell is helpful The shell is command line interpreter command arg1, arg2, …, argn - Command line consist of command name and arguments - The command name and arguments separated by spaces The site of command - Directory /bin contains all the commands generally used - Path of command may be including “/” character to specify
  • 21. 21 No special coding is needed handling I/O redirection The shell start with two files which have file descriptor 0, 1 - 0 is for reading, programs read massages typed by users - 1 is for writing, understood as the standard output The shell can change standard assignments of file descriptor The file name following “<” and “>” are called redirect - “<” means place out put - “>” take input followed arguments
  • 22. 22 Example of Standard I/O use $ ls >there - Create a file called “there” and places the listing $ ed <script - It interprets script as a file of editor command Execution Example
  • 23. 23 Filter copies standard input to its standard output A sequence of commands separated by vertical vars causes to execute simultaneously and standard out put of each commands is delivered to the next commands. $ cat /var/log/secure | grep sudo > sudo_result - $ cat /var/log/secure > temp1 - $ grep sudo < temp1 > temp2 - $ sudo_result < temp2 Example Divided…
  • 24. 24 The shell is itself a command $ ls; ed - With semicolon when ls ends, ed is executed $ as source >output & - Assembling source and diagnostic output going to output $ as source >output & ls >files & - Both assembly and listing in the background $ (date; ls) >x & - Print current date followed by listing output going to x
  • 25. 25 Sequential use of commands $ as source $ mv a.out testprog $ testprog as assembles code and output a.out (binary) mv causes a.out to be renamed testprog testprog executes itself $ sh <tryout sh to excute the commands sequentially
  • 26. 26 Waiting read return Analyze command line fork called How to work the Shell The new-line character
 ending the line is typed Putting the arguments in a form for execute fork childfork parent wait exec exit Die process
  • 27. 2727 When a process is created by the fork primitive - It inherits the core image, all open files in parents with file descriptor - Its child process automatically inherits file descriptor value When a n argument with “<” or “>” is given - Offspring process, before it execute, makes the standard 
 I/O file descriptor 0 or 1 respectively refer to the named file Terminate point - Discovering an end of file, the Shell terminates
  • 28. 28 init creates one process for each typewriter channel The last step in the initialization of UNIX is the creation of a 
 single process and invocation of a program called init. When init was invoked there were no files open, in each 
 process I/O devices will receive 0 or 1 file descriptor. When user typed correct login name and password, init will 
 wake up and change the user’s default current directory. Logout need only type the end of the file sequence.
  • 29. 29 Faults cause the processor to trap to a system routine Faults are such as.. - Referring nonsexist memory, unimplemented instruction… When an illegal action is caught, the system terminates the 
 process and writes the user’s image on file core A debugger can be used to determine faults “deletes” is interrupt signal which simply cease execution quit signal is also used to force a core image to be produced
  • 30. 30 Three consideration influenced the design of UNIX ❶ From programmers perspective… - Interactive system is much more productive and satisfying to 
 use than a “batch” system ❷ Severe regulation of system an d its software - The size constraint made economy and elegance of design. ❸ UNIX is able to maintain themselves - Programs are always available and modified online, we were 
 willing to rewrite the system when new idea were invented