Download presentation
Presentation is loading. Please wait.
1
CSE350 Software Design and Engineering University of Pennsylvania Professor Jonathan M. Smith http://www.cis.upenn.edu/~jms Office: 254 Moore GRW, Phone: 8-9509 January 9th, 2001
2
Administrative lFirst group assignment Tuesday, 1/15 lGroups will be formed today lWe will use http://www.cis.upenn.edu/~cse350 as the class web site http://www.cis.upenn.edu/~cse350 lIt’s currently outdated – will fix
3
What is an operating system? lAn operating system manages hardware resources lTypically, for multiple users lProtection, services such as file systems (structure), concurrent execution, buffering, etc. lIn UNIX (for example), OS functions are privileged – behind a protection boundary
4
The Unix Time-sharing System (slides from J.R. Davin) lD. M. Ritchie and K. Thompson. The Unix time-sharing system. BSTJ, 57:6 (July-August, 1978), 1905- 1929. lK. Thompson. Unix implementation. BSTJ, 57:6 (July-August, 1978), 1931- 1946.
5
Features lA hierarchical filesystem incorporating demountable volumes lCompatible file, device, interprocess communication lThe ability to initiate asynchronous processes lSystem command language selectable on a per-user basis lOver 100 subsystems including a dozen languages lHigh degree of portability
6
Economics of the 1970s lHardware cost: $40,000 lSoftware cost: two man-years lCost recovery for disk space
7
PDP-11/70 Platform l16-bit word (8-bit byte) l768 KBytes core memory lSystem kernel 90 KBytes lMinimal system 96 Kbytes lTwo 200 MByte moving-head disks l20 variable speed (300 to 1200 baud) communication interfaces l12 communication lines (9600 baud) lSynchronous interfaces (2400 and 4800 baud) for inter-machine file transfer lNine-track tape, line printer, phototypesetter lVoice synthesizer, digital switching network, chess machine
8
A Unix System in 1978 lUser population: 125 lMaximum simultaneous users: 33 lDirectories: 1630 lFiles: 28300 lDisk blocks (512-byte) used: 301,700 lDaily command invocations: 13500 lDaily (non-idle) CPU hours: 9.6 lDaily connect hours: 230
9
The C Programming Language lSystem re-coded in C in summer, 1973 l1/3 bigger than assembler language version
10
Observation "The most important role of the system is to provide a file system." (Page 1907)
11
Filesystem Properties lInternal file structure controlled by application programs lInternal file structure not imposed by system lHierarchy lDirectories as files l"." and ".." convention lLinks lRestrictions on namespace topology lMountable volumes
12
File Types lOrdinary lDirectory lSpecial Character Block
13
Filesystem Representation li-Number li-List li-Node
14
File Properties lOwner user-id lOwner group-id lProtection bits lPhysical disk (or tape) address of contents lSize lTime of creation lTime of last use lTime of last modification lNumber of links lFile type
15
File Protection lUser (owner) read, write, execute lGroup read, write, execute lOthers read, write, execute lSet-user-id --drwxwrxrwx l"Execute" permission on directories
16
Filesystem API lfilep = open (name, flag) lfilep = creat (name) ln = read (filep, buffer, count) ln = write (filep, buffer, count) llocation = lseek (filep, offset, base)
17
Why file descriptors? Consider open(“/home/jms/cse350.txt”) Consider read(“/home/jms/cse350.txt”) open() happens once, read() many times Pay cost of name lookup, permissions checks (existence!) at open(), reuse results, repetitively, at read() open() returns a descriptor, used by read()
18
Example: copy a file from one place to another main() { char c; int r_fd = 0, w_fd = 1; while( read(r_fd, &c, 1) > 0 ) write(w_fd, &c, 1); }
19
Crossing protection boundary lHow does a program access services? lIt does so through entry points called system calls These include read(), write(), open(), close() and creat() lAppear to be subroutines calls in “C”
20
File Space Management lBlocks 0 through 9 indicated in i-node lBlocks 10 through 137 indicated indirectly lBlocks 138 through 16521 indicated doubly indirectly lBlocks 16522 and higher indicated triply indirectly Performance Techniques: caching and read- ahead
21
Special File Naming Example Name: /dev/foo lMajor Device Number: selects driver code lMinor Device Number: selects device instance within class
22
File System Data Structure
23
Process Management API lprocessid = fork () lexecute (file, arg1,..., argN) lprocessid = wait (& status) lexit (status) lfilep = pipe () lTraps, Signals lMinimalist, integrated process synchronization
24
Process Control Data Structure
25
The Shell and Reusability lRedirection lStdin, stdout, stderr lPipes and filters lArgument parsing and globbing lMultitasking lBasic control structures
26
Perspective "The success of the Unix system is largely due to the fact that it was not designed to meet any predefined objectives.“ (Page 1926) Motivation: dissatisfaction with existing facilities.
27
Retrospective Design Considerations lEasy to write, test, run programs Interactive use lConstraints on size lSelf-maintenance Available source code
28
Easy Programming lDevice-independent file abstraction lNo "access methods" lFew system constraints on program
29
Influences lfork () from GENIE time-sharing system lI/O API from Multics lShell concept from Multics lImplementing "system" code as user primitives from Multics
30
Unix Implementation l10,000 lines of C code l1,000 lines of assembler code 800 lines not possible in C 200 lines for efficiency
31
Observation "Throughout, simplicity has been substituted for efficiency." (Page 1932)
32
Observation "The UNIX kernel is an I/O multiplexer more than a complete operating system. This is as it should be." (Page 1945)
33
Unsupported (unwanted?) features: lFile access methods lFile disposition lFile formats lFile maximum size lSpooling lCommand language lLogical records lPhysical records lLogical file names lMultiple character sets lOperator and operator console lLogin and logout
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.