week9_friday - CSCC 69H3 Operating Systems Spring 2010...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSCC 69H3 Operating Systems Spring 2010 Professor Bianca Schroeder U of T New topic: File systems! What do file systems do? They provide two nice abstraction of storage: Files & directories Hard Disks Read block Write block Reality / usr1 demke schroeder peterson papers grants Abstraction File Concept A file is named collection of data with some attributes Name Owner Location Size Protection Creation time Time of last access File Types A file’s type can be encoded in its name or contents Windows encodes type in name .exe, .doc, .jpg, etc. Unix encodes type in contents (sometimes) Magic numbers, initial characters (e.g., #! for shell scripts) Conceptual File Operation Create Write Read Repositioning within file Delete Truncating a file Open Close Unix (C library) creat(name) write(fd, buf, len) read(fd, buf, len) seek(fd, pos) unlink(name) truncate(fd, length) open(name, mode) close(fd) Where in the file do write and read operations operate? Why do we need open and close operations? File Access Methods General-purpose file systems support simple methods Sequential access – read bytes one at a time, in order read next write next Direct access – random access given block/byte number read n (byte at offset n) write n What does Unix use? both Unix (C library) read(fd, buf, len) write(fd, buf, len) seek(fd, pos) File Access Methods Database systems support more sophisticated methods Record access Indexed access John 75837 A David 63548 C+ Alice 92746 A Index Get record where name equals “Jim” Modern OS file systems support only simple methods (direct access, sequential access) Why? Conceptual File Operation Create Write Read Repositioning within file Delete Truncating a file Open Close Unix (C library) creat(name) write(fd, buf, len) read(fd, buf, len) seek(fd, pos) unlink(name) truncate(fd, length) open(name, mode) close(fd) Why do we need open and close operations? Handling operations on files Involves searching the directory for the entry associated with the named file when the file is first used actively, store its attribute info in a system-wide open-file table; the index into this table is used on subsequent operations ⇒ no searching Open File Table … … sample.txt … … Unix example (open, read, write are syscalls): main() { char onebyte; int fd = open (“sample.txt”, “r”); read(fd, &onebyte, 1); write(STDOUT, &onebyte, 1); close (fd); } Shared open files there are actually 2 levels of internal tables a per-process table of all files that each process has open (this holds the current file position for the process) each entry in the per-process table points to an entry in the system-wide open-file table (for process independent info) System-Wide Open File Table...
View Full Document

This note was uploaded on 05/22/2010 for the course CS CSCC69 taught by Professor Bianca during the Spring '10 term at University of Toronto.

Page1 / 48

week9_friday - CSCC 69H3 Operating Systems Spring 2010...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online