36 -OutlineLinksHard LinksAnnouncementsReading:LinksHard LinksSoft Links (Symlinks)Virtual File SystemRecall that in indexed allocation, directory justmaps names to inodesMap multiple names to exactly the same inode.SummaryI/O Basics1)a)b)2)3)4)MOS 4.1 - 4.2; 4.3.1 - 4.3.3; 4.3.7Quiz 4 this FridaySorry, I couldn't get project out.File Systems + I/O-sometimes we want a file to appear in multipledirectories for convenienceMOS Figure 4-18map names inB and C tothe sameinode--->works for files within the same file systemneed to do some reference countingturns the directory tree into a DAG (directedacyclic graph)can't hard link directories. why not?ExampleHow do we now handle deletion?Limitations:a.k.a. "symbolic" or "soft" linksAdvantagesDisadvantagesa special file that contains a path to a anotherlocation in the hierarchy.keep a link count and only delete the inodewhen this reaches 0Note that the inode number is the same, so`foo/bar` and `baz` are the same file on disk$ ls -i foo/bar2365607 foo/bar$ ln foo/bar baz$ ls -i foo/bar baz2365607 baz 2365607 foo/bar$ echo "hello world" > baz$ cat foo/barhello world$ touch fizz ; ln baz buzz$ ls -lihtotal 12K2365607 -rw-rw-r-- 3 rtsang1 rtsang1   12 Apr 21 23:04 baz2365607 -rw-rw-r-- 3 rtsang1 rtsang1   12 Apr 21 23:04 buzz2365608 -rw-rw-r-- 1 rtsang1 rtsang1    0 Apr 21 23:07 fizz2365606 drwxrwxr-x 2 rtsang1 rtsang1 4.0K Apr 21 23:01 foo$ stat buzz  File: buzz  Size: 12                Blocks: 8          IO Block: 4096   regular fileDevice: 8,1        Inode: 2365607     Links: 3Access: (0664/-rw-rw-r--)  Uid: ( 1000/ rtsang1)   Gid: ( 1000/ rtsang1)Access: 2026-04-21 23:04:18.487279725 -0400Modify: 2026-04-21 23:04:12.055273396 -0400Change: 2026-04-21 23:07:43.871486964 -0400 Birth: 2026-04-21 23:01:10.463099929 -0400$ ln -s buzz bee$ ls -lihtotal 12K2365607 -rw-rw-r-- 3 rtsang1 rtsang1 12 Apr 21 23:04 baz2365609 lrwxrwxrwx 1 rtsang1 rtsang1 4 Apr 21 23:19 bee -> buzz2365607 -rw-rw-r-- 3 rtsang1 rtsang1 12 Apr 21 23:04 buzz2365608 -rw-rw-r-- 1 rtsang1 rtsang1 0 Apr 21 23:07 fizz2365606 drwxrwxr-x 2 rtsang1 rtsang1 4.0K Apr 21 23:01 foo$ readlink beebuzz$ rm buzz$ ls -lihtotal 8.0K2365607 -rw-rw-r-- 2 rtsang1 rtsang1 12 Apr 21 23:04 baz2365609 lrwxrwxrwx 1 rtsang1 rtsang1 4 Apr 21 23:19 bee -> buzz2365608 -rw-rw-r-- 1 rtsang1 rtsang1 0 Apr 21 23:07 fizz2365606 drwxrwxr-x 2 rtsang1 rtsang1 4.0K Apr 21 23:01 foo$ readlink beebuzzMOS Figure 4-19---------can't link directories (parent directory issue)system knows to resolve to the contained pathcan link to directories (not a real parent)can link across file systems (just a path)kernel must resolve the pathname (performance)dangling linksspecial "symlink" bit to indicate resolutionnew inode is createdcan't link to files in other file systemsSymlinksbuzzfizzbeebazhello world~/tmp/buzzfizzbuzz~/tmpif a symlink pointsto a non-existentpath, it will fail toresolveVirtual File SystemMany different file systems existUser sees a single hierarchyUNIX achieves this with a VFS layer------different storage formats (disk, SSD, USB, etc)all interface with the same machineone tree encompassing multiple (incompatible)file systems, multiple drives, etc.provides abstraction to all file systemsfile system calls -> VFS -> reroute to FSstill has a superblock, still has directories, etc.VFS is typically also object oriented and based onv-nodes (virtual inodes)created by "mounting" file systems onto a treeall managed by same operating systeme.g. Linux ext4 + USB FAT32 + CD-ROM iso9660e.g. Linux mount & findmntMOS Figure 4-21diskdiskdisk-MOS Figure 4-22SummarySuperblockInode mapBlock mapInodesDatainode 2datainode 3dataroot dirinode 6datainode 2datainode 3data...Putting it all together (inode project)inode bitmap011101111111011111010011110111010001000000000011100000000000110000block bitmap1111111111110111110111111111001111111110001110011100000001111111111110010000111111000000inode 1(unused)inode 2inode 3(free)inode 5inode 6...magic: (fs type)inode map size: 1block map size: 2inodes size: 4root inode: 1free space managementinode tableI/ORecall:I/O ends up being a lot of kernel code.Some of these can be categorizedOthers cannotDevices also have a wide range of communicationspeeds.kernel controls all I/O deviceskernel provides software interfaceissue commands to devicesdevice driver abstractionscatch/handle interruptshandle errors----------disks, drives, etc.printers, network, serial------------------keyboardUSBcameraBluetoothWifitimerseverything elsemonitorEthernetmousebatteryfingerprintdiskspeakersBlock devices (storage)Character devicesclocksmemory-mapped screensbuttons?kernel needs to beperformant enoughto handle a lotsimultaneouslyHardware Recap:MemoryVideoControllerKeyboardControllerHDDControllerMMUCPUBusI/O DevicesOn-boardHDMIPortUSBPortUSBPortSATAPortUSBControllerBased on MOS Figure 1-6Ports are device connection pointsBuses are internal interconnectsKernel mostly cares about the ControllersQuestions:------------peripheral buses (PCI/PCIe) for higher speedinterface to the deviceHow do you provide standard interfaces/abstractions for 1000's of different devices?How do you make unreliable devices reliable withsoftware?How do you manage unpredictable inputs or slowcommunication speeds?provides:bit stream conversion to byteserror correctiondata movement to/from host memoryconfiguration interfaceetc.expansion buses (USB) for lower speed