1 / 57

Lecture 2 – Booting and Files

Lecture 2 – Booting and Files. Views of Operating Systems OS Files Booting iNodes Links Compression. OS Definitions By View. An “OS” is somewhat nebulous to define Various groups emphasize different pieces. OS - Functionality.

zuriel
Download Presentation

Lecture 2 – Booting and Files

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 2 – Booting and Files • Views of Operating Systems • OS Files • Booting • iNodes • Links • Compression

  2. OS Definitions By View • An “OS” is somewhat nebulous to define • Various groups emphasize different pieces

  3. OS - Functionality From the book by Silbershatz and others:  "What are the three main purposes of an operating system? • To provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner. • To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible. • As a control program it serves two major functions: (a) supervision of the execution of user programs to prevent errors and improper use of the computer, and (b) management of the operation and control of I/O devices."

  4. OS - Components • An OS consists of: • Virtual Machine • File Manager • Process Manager • Network • Input/Output • User Manager • Booting • System programs

  5. OS - Components • An alternative view: • Kernel (“core” of the OS) • RAM disk (memory) • Drivers (programs to talk to hardware) • Interrupt handlers (software to deal with interrupts)

  6. OS - Components • These are NOT parts of the OS: • GUIs (KDE, Windows Explorer) • CLIs (bash, cmd, powershell) • IE, Word, Acrobat Reader, Netbeans, notepad

  7. OS – System Calls • “What can it do?” • cd, chown, writev, tanf, stdrup, printf, mctl, … • http://technet.microsoft.com/en-us/library/cc754234.aspx

  8. OS - Files • Linux • /boot/grub: the bootloader • Vmlinuz: the kernel (“linked”) • Initrd.gz: system files needed for booting • /lib/modules: Dynamically loadable modules for kernel

  9. OS - Files • Linux • /sbin: system programs • /usr/sbin: more system progs • Swap space (separate partition) • /bin, /usr/bin, …: Not part of OS

  10. OS - Files • Windows • Ntldr: the bootloader • Ntoskrnl: the kernel • Bunch of DLLs • Hal.dll: hardware abstraction layer • Pagefile.sys: virtual memory bookkeeper

  11. Booting the OS • Very complex • http://www.pcguide.com/ref/mbsys/bios/bootSequence-c.html

  12. OS on USB • Installation of Windows and/or Linux on a flash drive • 2 Ways to install • “Regular” install: Install as normal, but select drive as target • “Manual” install: Boot into OS; copy content onto flash drive; install bootloader; close eyes and hope it works

  13. OS on USB • Installation of Windows and/or Linux on a flash drive • 2 Ways to install • “Regular” install: Install as normal, but select drive as target • “Manual” install: Boot into OS; copy content onto flash drive; install bootloader; close eyes and hope it works

  14. Hard Drive Layout Dear students, Please give the bearded man a moment to draw pretty pictures. They will help you! Your Instructor

  15. Hard Drive Layout • /dev/sda1 • /dev/ • sd • a • 1

  16. Partitions • RVH’s number game • Use 1000111001 • Vfat vs. ntfs vs. ext2/3/4

  17. Hard Drive Layout • Partitions • Divisions of hard drive • Volume • Different from partitions • Can expand multiple partitions

  18. Overview • Partition the USB drive • Make file volume (format) • Mount • Copy OS files • Install GRUB

  19. Lab Notes • Our installation is identical, except: • Smaller (probably) • Slower • Slower than HDD • Might not be swap partition • Used compressed read-only file • Read-only

  20. Files • Usually stored on non-volatile medium • Sequence of bytes • RVH’s number game

  21. Files • Usually stored on non-volatile medium • Consist of name & content • Content is of bytes • RVH’s number game • Every file has a structure • Some file types impose a rigid structure • Others are loosely defined

  22. Filenames • Base name • Usually pretty open character set (a-Z, 0-9, #, ~, (, ), etc) • Extension • Usually 3 characters • Usually indicates file type • Windows relies heavily on ext. • Linux is a bit smarter (magic number)

  23. Filenames • Base + extension • Length usually limited by OS • Total path of no more than X bytes • Some conventions • Backup files ( .:~ ) • Autosave files ( #:.:# ) • Convention…not requirement

  24. Contents of a File • Text files (printable characters) • Binary files (nothing to see here) • Mixed/Heterogeneous files

  25. iNodes • OS doesn’t use “file names” • It uses a magic thing called an iNode • We talk about it here, but CEG433 will explain in detail

  26. iNodes Dear students, Please give the bearded man a moment to draw pretty pictures. They will help you! Your Instructor

  27. iNodes • Has: • Location on hard drive - block number(s) • File size • Last modification time • etc • Doesn’t have: • Content • File name (coming up)

  28. iNumbers • iNumber is an index into the array of iNodes • Every file has iNumber • File A and File B have different iNumbers • 0th iNumber is conventionally vacant

  29. Directory • It IS a file…it’s just special • Unless noted, “file” will NOT include directories. • 2-column table • Name (here it is!) • iNumber

  30. Directories • Row-order is irrelevant • We care about keeping association of file names and file content.

  31. Special Directory Files • Every directory knows itself • “ . ” • Every directory has a parent directory • “ .. ”

  32. Special Directory Files • Every directory knows itself • “ . ” • Every directory has a parent directory • “ .. ” • Who is the root’s parent directory?

  33. Special Directory Files • Every directory knows itself • “ . ” • Every directory has a parent directory • “ .. ” • Itself!

  34. Directory Tree • We exclude 2 things when we draw the tree

  35. Directory Tree • We exclude 2 things when we draw the tree • “ . “ and “ .. “

  36. Directory Tree • We exclude 2 things when we draw the tree • “ . “ and “ .. “ • Hard/Soft links • Hang on...we’ll get there!

  37. Directory Tree • Root • Linux • “/” • Windows • Kinda, sorta hidden a bit • Usually refer to its contents directly • C: , D: , etc

  38. Links • Has other meanings outside of “file” scope • i.e., not just hyperlinks • A link is (essentially) a pointer • One copy, lots of references

  39. Links • Every file MUST have at least one [hard]1 link • What happens when we don’t? • Files can have multiple links! 1. Ignore this word until we get to the next slide

  40. Links • Every file MUST have at least one [hard]1 link • What happens when we don’t? • “Floating data” • Files can have multiple links! 1. Ignore this word until we get to the next slide

  41. Hard Links • Hard link count = 1 • New [hard] links increment • How do we get these? • “ln origFile.txt newFile.txt” • What does this do?

  42. Hard Links • Hard link count = 1 • New [hard] links increment • How do we get these? • “ln origFile.txt newFile.txt” • What does this do? • “One copy…multiple references”

  43. Hard Links • When hard link count = 0: • No one needs the file • Delete it

  44. Soft Links • “Symbolic links” or “symlinks” • They are “Windows shortcuts” • We open the single original file • We assume the original file is there • If not, the link is “broken”

  45. Linux-Specific Links • Hard links must stay on partition & drive • Hard links cannot point to directories; soft links can

  46. Window-Specific Links • No hard links • “Junctions” are symlinks to directories • Soft links • “shortcuts” • Have extension of “lnk”

  47. File Types • Windows “needs” extensions • Linux is all grown up

  48. File Type Examples TXT C CPP PDF JAVA CLASS PY ODT HTM/HTML SO DLL O OBJ ZIP TAR GZ BZ2

  49. Interoperability • I made a file on Windows • Can I use it in Linux? • I made a file on Linux • Can I use it in Window? • Do MacOS-generated files play with anyone else?

  50. Interoperability • I made a file on Windows • Can I use it in Linux? • I made a file on Linux • Can I use it in Window? • Do MacOS-generated files play with anyone else? Maybe

More Related