Rights to copy. Dongkun Shin, SKKU

Size: px
Start display at page:

Download "Rights to copy. Dongkun Shin, SKKU"

Transcription

1 Rights to copy Copyright , Bootlin License: Creative Commons Attribution - Share Alike You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. Document sources: 1

2 6. Kernel Frameworks for Device Drivers 2

3 Kernel and Device Drivers In Linux, a driver is always interfacing with: a framework that allows the driver to expose the hardware features to user space applications. a bus infrastructure, part of the device model, to detect/communicate with the hardware. 3

4 Types of devices Essentially three types of devices under Linux: Network devices represented as network interfaces, visible in userspace using ifconfig. Block devices used to provide userspace applications access to raw storage devices (hard disks, USB keys). visible to the applications as device files in /dev. Character devices used to provide userspace applications access to all other types of devices (input, sound, graphics, serial, etc.). visible to the applications as device files in /dev. 4

5 Major and minor numbers Within the kernel, all block and character devices are identified using a major and a minor number. The major number typically indicates the family of the device. The minor number typically indicates the number of the device (when they are for example several serial ports) Major and minor numbers are statically allocated, and identical across all Linux systems. defined in admin-guide/devices. 5

6 Device Files Devices are represented as device files to the applications allows applications to manipulate all system objects with the normal file API (open, read, write, close, etc.) All device files are by convention stored in the /dev directory Device file name is associated to <type, major, minor> that the kernel understands Example of device files in a Linux system $ ls -l /dev/ttys0 /dev/tty1 /dev/sda1 /dev/sda2 /dev/zero brw-rw root disk 8, :56 /dev/sda1 brw-rw root disk 8, :56 /dev/sda2 crw root root 4, :57 /dev/tty1 crw-rw root dialout 4, :56 /dev/ttys0 crw-rw-rw- 1 root root 1, :56 /dev/zero block char Example C code that uses the usual file API to write data to a serial port int fd; fd = open("/dev/ttys0", O_RDWR); write(fd, "Hello", 5); close(fd); major minor 6

7 Creating Device Files On a basic Linux system, the device files have to be created manually using the mknod command mknod /dev/<device> [c b] major minor Needs root privileges Coherency between device files and devices handled by the kernel is left to the system developer On more elaborate Linux systems, mechanisms can be added to create/remove them automatically when devices appear and disappear devtmpfs: virtual filesystem (devfs 2.0, since Linux ) udev daemon: executes in userspace and listens to uevents the kernel sends mdev program: a lighter solution than udev (BusyBox) ueventd in Android 7

8 Character Driver For an application, a character device is essentially a file. Character device drive must implement file operations: open, close, read, write, etc. described in the struct file_operations structure Linux filesystem layer will ensure that the driver's operations are called when an userspace application makes the corresponding system call. 8

9 open() and release() int foo_open(struct inode *i, struct file *f) Called when user space opens the device file. Only implement this function when you do something special with the device at open() time. struct inode is a structure that uniquely represents a file in the system (be it a regular file, a directory, a symbolic link, a character or block device) struct file is a structure created every time a file is opened. Several file structures can point to the same inode structure. Contains information like the current position, the opening mode, etc. Has a void *private_data pointer that one can freely use. A pointer to the file structure is passed to all other operations int foo_release(struct inode *i, struct file *f) Called when user space closes the file. Only implement this function when you do something special with the device at close() time. 9

10 read() ssize_t foo_read(struct file *f, char user *buf, size_t sz, loff_t *off) Called when user space uses the read() system call on the device. Must read data from the device, write at most sz bytes to the user space buffer buf, and update the current position in the file off. f is a pointer to the same file structure that was passed in the open() operation Must return the number of bytes read. 0 is usually interpreted by userspace as the end of the file. On UNIX, read() operations typically block when there isn t enough data to read from the device 10

11 write() ssize_t foo_write(struct file *f, const char user *buf, size_t sz, loff_t *off) Called when user space uses the write() system call on the device The opposite of read, must read at most sz bytes from buf, write it to the device, update off and return the number of bytes written. 11

12 Exchanging data with user-space Kernel code isn't allowed to directly access user-space memory, using memcpy() or direct pointer dereferencing To keep the kernel code portable and have proper error handling, your driver must use special kernel functions to exchange data with userspace. A single value get_user(v, p); The kernel variable v gets the value pointed by the user-space pointer p put_user(v, p); The value pointed by the user-space pointer p is set to the contents of the kernel variable v. A buffer unsigned long copy_to_user(void user *to, const void *from, unsigned long n); unsigned long copy_from_user(void *to, const void user *from, unsigned long n); Return value: Zero on success, non-zero on failure (-EFAULT) 12

13 Exchanging data with user-space 13

14 Zero copy access to user memory Having to copy data to or from an intermediate kernel buffer can become expensive when the amount of data to transfer is large Zero copy options are possible: mmap() system call to allow user space to directly access memory mapped I/O space. get_user_pages() to get a mapping to user pages without having to copy them. Classical Data Transfer mmap Data Transfer 14

15 ioctl() vs. unlocked_ioctl() ioctl() Allows to extend the driver capabilities beyond the limited read/write API. example: changing the speed of a serial port, setting video output format, querying a device serial number... runs under the Big Kernel Lock (BKL). BKL invokes long-running ioctl(), long latencies for unrelated processes. long unlocked_ioctl(struct file *f, unsigned int cmd, unsigned long arg) Called unlocked because it didn't hold the BKL cmd is a number identifying the operation to perform arg is the optional argument passed as third argument of the ioctl() system call. Can be an integer, an address, etc. The semantic of cmd and arg is driver-specific. 15

16 ioctl() example Kernel Side Application Side 16

17 Beyond character drivers: kernel frameworks Many device drivers are not implemented directly as character drivers implemented under a framework, specific to a given device type (framebuffer, V4L, serial, etc.) Allows to factorize the common parts of drivers for the same type of devices From userspace, they are still seen as character devices by the applications Allows to provide a coherent userspace interface (ioctl, etc.) for every type of device, regardless of the driver Each framework defines a structure that a device driver must register to be recognized as a device in this framework struct uart_port for serial port, struct netdev for network devices, struct fb_info for framebuffers, etc. 17

18 Example: Framebuffer Framework Kernel option CONFIG_FB menuconfig FB tristate "Support for frame buffer devices" Implemented in C files in drivers/video/fbdev/core/ Defines the user/kernel API include/uapi/linux/fb.h Defines the set of operations a framebuffer driver must implement and helper functions for the drivers struct fb_ops include/linux/fb.h 18

19 Framebuffer driver operations The operations a framebuffer driver can or must implement, and define them in a struct fb_ops structure 19

20 Framebuffer driver code In the probe() function, registration of the framebuffer device and operations register_framebuffer() will create the character device that can be used by user space applications with the generic framebuffer API. 20

21 Device managed allocations The probe() function is typically responsible for allocating a significant number of resources: memory, mapping I/O registers, registering interrupt handlers, etc. These resource allocations have to be properly freed: In the probe() function, in case of failure In the remove() function This required a lot of failure handling code that was rarely tested To solve this problem, device managed allocations have been introduced. The idea is to associate resource allocation with the struct device, and automatically release those resources When the device disappears When the device is unbound from the driver Functions prefixed by devm_ See Documentation/driver-model/devres.txt for details 21

22 Device managed allocations: memory alloc example Normally done with kmalloc(size_t, gfp_t), released with kfree(void *) Device managed with devm_kmalloc(struct device *, size_t, gfp_t) 22

23 Driver-specific Data Structure Each framework defines a structure that a device driver must register to be recognized as a device in this framework struct uart_port for serial ports, struct net_device for network devices, struct fb_info for framebuffers, etc. In addition to this structure, the driver usually needs to store additional information about its device This is typically done By subclassing the appropriate framework structure By storing a reference to the appropriate framework structure Or by including your information in the framework structure 23

24 Driver-specific Data Structure Examples 24

25 Links between structures The framework typically contains a struct device * pointer that the driver must point to the corresponding struct device the relation between the logical device (for example a network interface) and the physical device (for example the USB network adapter) The device structure also contains a void * pointer that the driver can freely use. often used to link back the device to the higher-level structure from the framework. allows, for example, from the struct platform_device structure, to find the structure describing the logical device 25

26 Links between structures 26

27 Links between structures 27

28 Links between structures 28

29 Input subsystem Takes care of all the input events coming from the human user. Initially written to support the USB HID (Human Interface Device) devices, it quickly grew up to handle all kind of inputs (using USB or not): keyboards, mice, joysticks, touchscreens, etc. The input subsystem is split in two parts: Device drivers: they talk to the hardware (for example via USB), and provide events (keystrokes, mouse movements, touchscreen coordinates) to the input core Event handlers: they get events from drivers and pass them where needed via various interfaces (most of the time through evdev) In user space it is usually used by the graphic stack such as X.Org, Wayland or Android s InputManager. 29

30 Input subsystem diagram 30

31 Input subsystem overview Kernel option CONFIG_INPUT menuconfig INPUT tristate "Generic input layer (needed for keyboard, mouse,...)" Implemented in drivers/input/ input.c, input-polldev.c, evbug.c Implements a single character driver and defines the user/kernel API include/uapi/linux/input.h Defines the set of operations a input driver must implement and helper functions for the drivers struct input_dev for the device driver part struct input_handler for the event handler part include/linux/input.h 31

32 Input subsystem API (1/3) An input device is described by a very long struct input_dev structure Before being used it, this structure must be allocated and initialized, typically with: struct input_dev *devm_input_allocate_device(struct device *dev); 32

33 Input subsystem API (2/3) Depending on the type of events that will be generated, the input bit fields evbit and keybit must be configured: For example, for a button we only generate EV_KEY type events, and from these only BTN_0 events code: set_bit(ev_key, myinput_dev.evbit); set_bit(btn_0, myinput_dev.keybit); set_bit() is an atomic operation allowing to set a particular bit to 1 Once the input device is allocated and filled, the function to register it is: int input_register_device(struct input_dev *); When the driver is unloaded, the input device will be unregistered using: void input_unregister_device(struct input_dev *); 33

34 Input subsystem API (3/3) The events are sent by the driver to the event handler using input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); The event types are documented in Documentation/input/eventcodes.txt An event is composed by one or several input data changes (packet of input data changes) such as the button state, the relative or absolute position along an axis, etc.. After submitting potentially multiple events, the input core must be notified by calling: void input_sync(struct input_dev *dev): The input subsystem provides other wrappers such as input_report_key(), input_report_abs(),... 34

35 Polled input subclass The input subsystem provides a subclass supporting simple input devices that do not raise interrupts but have to be periodically scanned or polled to detect changes in their state. A polled input device is described by a struct input_polled_dev structure: 35

36 Polled input subsystem API Allocating the struct input_polled_dev structure is done using devm_input_allocate_polled_device() Among the handlers of the struct input_polled_dev only the poll() method is mandatory, this function polls the device and posts input events. The fields id, name, evkey and keybit of the input field must be initialized too. If none of the poll_interval fields are filled then the default poll interval is 500ms. The device registration/unregistration is done with: input_register_polled_device(struct input_polled_dev *dev) Unregistration is automatic after using devm_input_allocate_polled_device() 36

37 evdev user space interface The main user space interface to input devices is the event interface Each input device is represented as a /dev/input/event<x> character device A user space application can use blocking and non-blocking reads, but also select() (to get notified of events) after opening this device. Each read will return struct input_event structures of the following format: A very useful application for input device testing is evtest, from 37

38 Block Device 38

39 From userspace From userspace, block devices are accessed using device files, usually stored in /dev/ Created manually or dynamically by udev Most of the time, they store filesystems : they are not accessed directly, but rather mounted, so that the contents of the filesystem appears in the global hierarchy of files Block devices are also visible through the sysfs filesystem, in the /sys/block/ directory 39

40 Global architecture 40

41 Global architecture An user application can use a block device Through a filesystem, by reading, writing or mapping files Directly, by reading, writing or mapping a device file representing a block device in /dev In both cases, the VFS subsystem in the kernel is the entry point for all accesses A filesystem driver is involved if a normal file is being accessed The buffer/page cache of the kernel stores recently read and written portions of block devices critical component for the performance of the system 41

42 Standard Linux filesystem format: ext2, ext3, ext4 The standard filesystem used on Linux systems is the series of ext{2,3,4} filesystems ext2 ext3, brought journaling compared to ext2 ext4, mainly brought performance improvements and support for even larger filesystems It supports all features Linux needs from a filesystem: permissions, ownership, device files, symbolic links, etc. 42

43 Other Linux/Unix filesystems btrfs, intended to become the next standard filesystem for Linux. Integrates numerous features: data checksuming, integrated volume management, snapshots, etc. XFS, high-performance filesystem inherited from SGI IRIX, still actively developed. JFS, inherited from IBM AIX. No longer actively developed, provided mainly for compatibility. reiserfs, used to be a popular filesystem, but its latest version Reiser4 was never merged upstream. All those filesystems provide the necessary functionalities for Linux systems: symbolic links, permissions, ownership, device files, etc. 43

44 F2FS: filesystem for flash-based storage Filesystem that takes into account the characteristics of flash-based storage: emmc, SD cards, SSD, etc. Developed and contributed by Samsung Available in the mainline Linux kernel For optimal results, need a number of details about the storage internal behavior which may not easy to get Benchmarks: best performance on flash devices most of the time: See Technical details: paper-lee.pdf F2FS: A New File System for Flash Storage (FAST 15) Not as widely used as ext3,4, even on flash-based storage. 44

45 Squashfs: read-only filesystem Read-only, compressed filesystem for block devices. Fine for parts of a filesystem which can be read-only (kernel, binaries...) Great compression rate, which generally brings improved read performance Used in most live CDs and live USB distributions Supports several compression algorithms (LZO, XZ, etc.) Benchmarks: roughly 3 times smaller than ext3, and 2-4 times faster ( Details: 45

46 new EROFS file system (Kernel 4.19) stands for Enhanced Read-Only File System, developed at Huawei lightweight read-only file system designed for embedded devices with very limited physical memory and lots of memory consumers, such as Android devices. VLE (variable-length extent) compression, fixed-sized compressed size rather than fixed-sized input size all data read from block device at once can be utilized, and read amplification can be easier to estimate and control; generally, it has a better compression ratio than fixed-sized input compression approaches configured with the same size; aggressively optimized paths such as partial page read can be implemented to gain better performance for page-unaligned read (unimplemented yet, in TODO list). 46

47 Two main types of drivers Most of the block device drivers are implemented below the I/O scheduler, to take advantage of the I/O scheduling Hard disk drivers, CDROM drivers, etc. For some drivers however, it doesn't make sense to use the IO scheduler RAID and volume manager, like md The special loop driver Memory-based block devices 47

48 Linux Virtual Files System (VFS) abstraction interface layer between user process and file system implementations. provides common object models (such as i-node, file object, page cache, directory entry, and so on) and methods to access file system objects. hides the differences of each file system implementation from user processes. user processes do not need to know which file system to use, or which system call should be issued for each file system. 48

49 Linux I/O Subsystem Writing data to a disk 1. A process requests to write a file through the write() system call. 2. The kernel updates the page cache mapped to the file. 3. A pdflush kernel thread takes care of flushing the page cache to disk. sync cmd 4. The file system layer puts each block buffer together to a bio struct and submits a write request to the block device layer. 5. The block device layer gets requests from upper layers and performs an I/O elevator operation and puts the requests into the I/O request queue. 6. A device driver such as SATA will take care of write operation. 7. A disk device firmware performs hardware operations like seek head, rotation, and data transfer to the sector on the platter. 49

50 mmap Possibility to have parts of the virtual address space of a program mapped to the contents of a file Particularly useful when the file is a device file Allows to access device I/O memory and ports without having to go through (expensive) read, write or ioctl calls One can access to current mapped files by two means: /proc/<pid>/maps pmap <pid> 50

51 mmap Overview 51

52 VFS Common Objects superblock describes and maintains state for the file system inode contains all the metadata to manage objects in the file system (including the operations that are possible on it) dentry translate between names and inodes, for which a directory cache exists to keep the most-recently used around. maintains relationships between directories and files for traversing file systems. file object represents an open file keeps state for the open file such as the write offset, and so on 52

53 Block I/O Layer Structures File virtually contiguous Segment virtually contiguous memory pages Block Logical storage space Bio : primitive disk block I/O Request : one or more bios (contiguous in logical address) 53

54 bio Structure struct bio struct bio *bi_next struct bio struct bio *bi_bdev *bi_io_vec struct block_device struct bio_vec struct bio_vec Segment struct bio_vec bi_vcnt bv_page bv_page bv_page bi_sector bv_len bv_len bv_len bi_size bv_offset bv_offset bv_offset bi_vcnt 54

55 request Structure struct request struct request queue_list struct request queue_list bio bio_tail sector nr_sectors struct bio struct bio struct bio struct request queue_list Storage Memory 55

56 Request example 56

57 I/O Scheduler Elevator layer Generic block layer invokes the I/O scheduler via elevator layer (interface) Fundamental I/O scheduler functions (Merge/Searching) I/O Scheduler Determine that exact position of the new element in the queue Tries to keep the request queue sorted by sector Several scheduling policy Flush daemon Dispatch requests from I/O scheduler and send them to device IO system call Flush daemon 57

58 I/O Schedulers 58

59 Available I/O schedulers Four I/O schedulers in current kernels Noop, for non-disk based block devices Deadline, tries to guarantee that an I/O will be served within a deadline CFQ, the Complete Fairness Queuing, the default scheduler, tries to guarantee fairness between users of a block device The current scheduler for a device can be get and set in /sys/block/<dev>/queue/scheduler 59

60 Noop I/O Scheduler No data ordering, Simplest FIFO Schedule 60

61 Deadline Scheduler Impose a deadline on all I/O operations to prevent starvation of requests. Maintains two deadline queues, and two sorted queues (both read and write). Deadline queues are basically sorted by their deadline (the expiration time) Sorted queues are sorted by the sector number. Read queues are given a higher priority If the first request in the deadline queue has expired, D/L scheduler serves it first. Otherwise, the scheduler serves a batch of requests from the sorted queue. Benefits Nearly a real-time scheduler. Excels in reducing latency of any given single I/O Does quite well in benchmarks, most likely the best Good for solid state/flash drives Disadvantages If the phone is overloaded, crashing or unexpected closure of processes can occur 61

62 I/O Scheduler Complete Fairness Queuing (CFQ) QoS (Quality of Service) by maintaining per-process I/O queues For large multi-user systems with a lot of competing processes Avoid starvation of processes Default I/O scheduler Can slowdown a single main application ionice command can set the priority of process Process 1 Process 2 Dispatch Queue Round Robin (time Slice) Process 3 Process 4 Queue sorted by sector 62

63 File System and Storage Tuning vmstat monitor the movement of blocks in and out of the disk subsystem. iostat Shows disk utilization 63

64 File System and Storage Tuning IO Scheduler # echo "noop" > /sys/block/<block_device>/queue/scheduler nr_requests (NCQ) the number of requests that can be issued to a storage # echo 64 > /sys/block/sdb/queue/nr_requests read_ahead_kb defines how large read ahead operations can be For large streaming reads, a large size of the read ahead buffer might increase performance. # cat /sys/block/<disk>/queue/read_ahead_kb # echo 64 > /sys/block/<disk>/queue/read_ahead_kb ionice assign I/O priority at CFQ I/O elevator Can restrict the storage utilization of a specific process. Idle: access to the storage if no other processes with a priority of best-effort or higher request access to data. Best-effort: default. Processes will inherit 8 levels of the priority of their respective CPU nice level to the I/O priority class. Real time: The highest available I/O priority options: -c<#> I/O priority 1 for real time, 2 for best-effort, 3 for idle -n<#> I/O priority class data 0 to 7 -p<#> process id of a running task # ionice -c 3 -p113 (Sets process with PID 113 as an idle io process) # ionice -c 2 -n 0 bash (Runs 'bash' as a best-effort program with highest priority) 64

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014 CS5460/6460: Operating Systems Lecture 24: Device drivers Anton Burtsev April, 2014 Device drivers Conceptually Implement interface to hardware Expose some high-level interface to the kernel or applications

More information

Linux storage system basics

Linux storage system basics Linux storage system basics Storage device A computer runs programs that are loaded in memory The program is loaded from a storage device The result of an execution is stored to a storage device Storage

More information

To understand this, let's build a layered model from the bottom up. Layers include: device driver filesystem file

To understand this, let's build a layered model from the bottom up. Layers include: device driver filesystem file Disks_and_Layers Page 1 So what is a file? Tuesday, November 17, 2015 1:23 PM This is a difficult question. To understand this, let's build a layered model from the bottom up. Layers include: device driver

More information

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel Chapter-6 SUBJECT:- Operating System TOPICS:- I/O Management Created by : - Sanjay Patel Disk Scheduling Algorithm 1) First-In-First-Out (FIFO) 2) Shortest Service Time First (SSTF) 3) SCAN 4) Circular-SCAN

More information

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13 I/O Handling ECE 650 Systems Programming & Engineering Duke University, Spring 2018 Based on Operating Systems Concepts, Silberschatz Chapter 13 Input/Output (I/O) Typical application flow consists of

More information

Linux BIO and Device Mapper

Linux BIO and Device Mapper Linux BIO and Device Mapper (NetDiox R&D Team) Authored By : Peter Chacko, Founder & CTO Netdiox Computing System Pvt Ltd (Linux kernel research/training center) About the Author: Peter Chacko has been

More information

Operating Systems 2010/2011

Operating Systems 2010/2011 Operating Systems 2010/2011 Input/Output Systems part 1 (ch13) Shudong Chen 1 Objectives Discuss the principles of I/O hardware and its complexity Explore the structure of an operating system s I/O subsystem

More information

Operating System Concepts Ch. 11: File System Implementation

Operating System Concepts Ch. 11: File System Implementation Operating System Concepts Ch. 11: File System Implementation Silberschatz, Galvin & Gagne Introduction When thinking about file system implementation in Operating Systems, it is important to realize the

More information

The Journey of an I/O request through the Block Layer

The Journey of an I/O request through the Block Layer The Journey of an I/O request through the Block Layer Suresh Jayaraman Linux Kernel Engineer SUSE Labs sjayaraman@suse.com Introduction Motivation Scope Common cases More emphasis on the Block layer Why

More information

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017 CIS 5512 - Operating Systems I/O Systems & Secondary Storage Professor Qiang Zeng Fall 2017 Previous class Memory subsystem How to allocate physical memory? How to do address translation? How to be quick?

More information

CS2506 Quick Revision

CS2506 Quick Revision CS2506 Quick Revision OS Structure / Layer Kernel Structure Enter Kernel / Trap Instruction Classification of OS Process Definition Process Context Operations Process Management Child Process Thread Process

More information

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems I/O Systems & Secondary Storage Professor Qiang Zeng Spring 2018 Previous class Memory subsystem How to allocate physical memory? How to do address translation? How to be quick?

More information

Linux SMR Support Status

Linux SMR Support Status Linux SMR Support Status Damien Le Moal Vault Linux Storage and Filesystems Conference - 2017 March 23rd, 2017 Outline Standards and Kernel Support Status Kernel Details - What was needed Block stack File

More information

Operating Systems. V. Input / Output

Operating Systems. V. Input / Output Operating Systems V. Input / Output Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ @OS Eurecom Devices of a Computer System Applications OS CPU Memory

More information

Block device drivers. Block device drivers. Thomas Petazzoni Free Electrons

Block device drivers. Block device drivers. Thomas Petazzoni Free Electrons Block device drivers Block device drivers Thomas Petazzoni Free Electrons Copyright 2008 2009, Free Electrons. Creative Commons BY SA 3.0 license Latest update: Sep 15, 2009, Document sources, updates

More information

W4118 Operating Systems. Instructor: Junfeng Yang

W4118 Operating Systems. Instructor: Junfeng Yang W4118 Operating Systems Instructor: Junfeng Yang File systems in Linux Linux Second Extended File System (Ext2) What is the EXT2 on-disk layout? What is the EXT2 directory structure? Linux Third Extended

More information

SMD149 - Operating Systems - File systems

SMD149 - Operating Systems - File systems SMD149 - Operating Systems - File systems Roland Parviainen November 21, 2005 1 / 59 Outline Overview Files, directories Data integrity Transaction based file systems 2 / 59 Files Overview Named collection

More information

Block Device Scheduling. Don Porter CSE 506

Block Device Scheduling. Don Porter CSE 506 Block Device Scheduling Don Porter CSE 506 Logical Diagram Binary Formats Memory Allocators System Calls Threads User Kernel RCU File System Networking Sync Memory Management Device Drivers CPU Scheduler

More information

Block Device Scheduling

Block Device Scheduling Logical Diagram Block Device Scheduling Don Porter CSE 506 Binary Formats RCU Memory Management File System Memory Allocators System Calls Device Drivers Interrupts Net Networking Threads Sync User Kernel

More information

ECE 598 Advanced Operating Systems Lecture 19

ECE 598 Advanced Operating Systems Lecture 19 ECE 598 Advanced Operating Systems Lecture 19 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 7 April 2016 Homework #7 was due Announcements Homework #8 will be posted 1 Why use

More information

Block Device Driver. Pradipta De

Block Device Driver. Pradipta De Block Device Driver Pradipta De pradipta.de@sunykorea.ac.kr Today s Topic Block Devices Structure of devices Kernel components I/O Scheduling USB Device Driver Basics CSE506: Block Devices & IO Scheduling

More information

File System. Computadors Grau en Ciència i Enginyeria de Dades. Xavier Verdú, Xavier Martorell

File System. Computadors Grau en Ciència i Enginyeria de Dades. Xavier Verdú, Xavier Martorell File System Computadors Grau en Ciència i Enginyeria de Dades Xavier Verdú, Xavier Martorell Facultat d Informàtica de Barcelona (FIB) Universitat Politècnica de Catalunya (UPC) 2017-2018 Q2 Creative Commons

More information

Operating Systems Design Exam 2 Review: Spring 2011

Operating Systems Design Exam 2 Review: Spring 2011 Operating Systems Design Exam 2 Review: Spring 2011 Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 CPU utilization tends to be lower when: a. There are more processes in memory. b. There are fewer processes

More information

Example Implementations of File Systems

Example Implementations of File Systems Example Implementations of File Systems Last modified: 22.05.2017 1 Linux file systems ext2, ext3, ext4, proc, swap LVM Contents ZFS/OpenZFS NTFS - the main MS Windows file system 2 Linux File Systems

More information

Unix (Linux) Device Drivers

Unix (Linux) Device Drivers Unix (Linux) Device Drivers Kernel module that handles the interaction with an specific hardware device, hiding its operational details behind a common interface Three basic categories Character Block

More information

CS 416: Opera-ng Systems Design March 23, 2012

CS 416: Opera-ng Systems Design March 23, 2012 Question 1 Operating Systems Design Exam 2 Review: Spring 2011 Paul Krzyzanowski pxk@cs.rutgers.edu CPU utilization tends to be lower when: a. There are more processes in memory. b. There are fewer processes

More information

Compression and Replication of Device Files using Deduplication Technique

Compression and Replication of Device Files using Deduplication Technique Compression and Replication of Device Files using Deduplication Technique Bharati Ainapure Assistant Professor Department of Computer Engineering. MITCOE, Pune University, India. Siddhant Agarwal Abhishek

More information

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems File system internals Tanenbaum, Chapter 4 COMP3231 Operating Systems Architecture of the OS storage stack Application File system: Hides physical location of data on the disk Exposes: directory hierarchy,

More information

Computer Systems Laboratory Sungkyunkwan University

Computer Systems Laboratory Sungkyunkwan University File System Internals Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics File system implementation File descriptor table, File table

More information

Caching and reliability

Caching and reliability Caching and reliability Block cache Vs. Latency ~10 ns 1~ ms Access unit Byte (word) Sector Capacity Gigabytes Terabytes Price Expensive Cheap Caching disk contents in RAM Hit ratio h : probability of

More information

Device Drivers. CS449 Fall 2017

Device Drivers. CS449 Fall 2017 Device Drivers CS449 Fall 2017 Software Layers User-level I/O so7ware & libraries Device-independent OS so7ware Device drivers Interrupt handlers User OperaEng system (kernel) Hardware Device Drivers User

More information

(MCQZ-CS604 Operating Systems)

(MCQZ-CS604 Operating Systems) command to resume the execution of a suspended job in the foreground fg (Page 68) bg jobs kill commands in Linux is used to copy file is cp (Page 30) mv mkdir The process id returned to the child process

More information

File System Performance (and Abstractions) Kevin Webb Swarthmore College April 5, 2018

File System Performance (and Abstractions) Kevin Webb Swarthmore College April 5, 2018 File System Performance (and Abstractions) Kevin Webb Swarthmore College April 5, 2018 Today s Goals Supporting multiple file systems in one name space. Schedulers not just for CPUs, but disks too! Caching

More information

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File File File System Implementation Operating Systems Hebrew University Spring 2007 Sequence of bytes, with no structure as far as the operating system is concerned. The only operations are to read and write

More information

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O CS162 Operating Systems and Systems Programming Lecture 18 Systems October 30 th, 2017 Prof. Anthony D. Joseph http://cs162.eecs.berkeley.edu Recall: How do we Hide I/O Latency? Blocking Interface: Wait

More information

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo I/O AND DEVICE HANDLING 2016 Operating Systems Design Euiseong Seo (euiseong@skku.edu) I/O Hardware Incredible variety of I/O devices Common concepts Port Bus (daisy chain or shared direct access) Controller

More information

Improving Disk I/O Performance on Linux. Carl Henrik Lunde, Håvard Espeland, Håkon Kvale Stensland, Andreas Petlund, Pål Halvorsen

Improving Disk I/O Performance on Linux. Carl Henrik Lunde, Håvard Espeland, Håkon Kvale Stensland, Andreas Petlund, Pål Halvorsen Improving Disk I/O Performance on Linux Carl Henrik Lunde, Håvard Espeland, Håkon Kvale Stensland, Completely Fair Queuing Default scheduler on Linux Ensures complete fairness among I/O-requests in the

More information

The Active Block I/O Scheduling System (ABISS)

The Active Block I/O Scheduling System (ABISS) The Active Block I/O Scheduling System (ABISS) Benno van den Brink Philips Research, Eindhoven, The Netherlands Werner Almesberger Buenos Aires, Argentina 1 ABISS Extension to Storage subsystem Allow applications

More information

Module 12: I/O Systems

Module 12: I/O Systems Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Performance 12.1 I/O Hardware Incredible variety of I/O devices Common

More information

Linux Device Drivers. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5. Interrupts

Linux Device Drivers. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5. Interrupts Linux Device Drivers Dr. Wolfgang Koch Friedrich Schiller University Jena Department of Mathematics and Computer Science Jena, Germany wolfgang.koch@uni-jena.de Linux Device Drivers 1. Introduction 2.

More information

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand File Systems Basics Nima Honarmand File and inode File: user-level abstraction of storage (and other) devices Sequence of bytes inode: internal OS data structure representing a file inode stands for index

More information

I/O. CS 416: Operating Systems Design Department of Computer Science Rutgers University

I/O. CS 416: Operating Systems Design Department of Computer Science Rutgers University I/O Design Department of Computer Science http://www.cs.rutgers.edu/~vinodg/416 I/O Devices So far we have talked about how to abstract and manage CPU and memory Computation inside computer is useful only

More information

Operating Systems. Week 9 Recitation: Exam 2 Preview Review of Exam 2, Spring Paul Krzyzanowski. Rutgers University.

Operating Systems. Week 9 Recitation: Exam 2 Preview Review of Exam 2, Spring Paul Krzyzanowski. Rutgers University. Operating Systems Week 9 Recitation: Exam 2 Preview Review of Exam 2, Spring 2014 Paul Krzyzanowski Rutgers University Spring 2015 March 27, 2015 2015 Paul Krzyzanowski 1 Exam 2 2012 Question 2a One of

More information

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University File System Internals Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics File system implementation File descriptor table, File table

More information

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition Chapter 13: I/O Systems Silberschatz, Galvin and Gagne 2013 Chapter 13: I/O Systems Overview I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations

More information

Comp 204: Computer Systems and Their Implementation. Lecture 18: Devices

Comp 204: Computer Systems and Their Implementation. Lecture 18: Devices Comp 204: Computer Systems and Their Implementation Lecture 18: Devices 1 Today Devices Introduction Handling I/O Device handling Buffering and caching 2 Operating System An Abstract View User Command

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance Objectives Explore the structure of an operating

More information

Operating Systems Design Exam 2 Review: Fall 2010

Operating Systems Design Exam 2 Review: Fall 2010 Operating Systems Design Exam 2 Review: Fall 2010 Paul Krzyzanowski pxk@cs.rutgers.edu 1 1. Why could adding more memory to a computer make it run faster? If processes don t have their working sets in

More information

Files and the Filesystems. Linux Files

Files and the Filesystems. Linux Files Files and the Filesystems Linux Files The file is the most basic and fundamental abstraction in Linux. Linux follows the everything-is-a-file philosophy. Consequently, much interaction occurs via reading

More information

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems File system internals Tanenbaum, Chapter 4 COMP3231 Operating Systems Summary of the FS abstraction User's view Hierarchical structure Arbitrarily-sized files Symbolic file names Contiguous address space

More information

Device-Functionality Progression

Device-Functionality Progression Chapter 12: I/O Systems I/O Hardware I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Incredible variety of I/O devices Common concepts Port

More information

Chapter 12: I/O Systems. I/O Hardware

Chapter 12: I/O Systems. I/O Hardware Chapter 12: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations I/O Hardware Incredible variety of I/O devices Common concepts Port

More information

I/O. Disclaimer: some slides are adopted from book authors slides with permission 1

I/O. Disclaimer: some slides are adopted from book authors slides with permission 1 I/O Disclaimer: some slides are adopted from book authors slides with permission 1 Thrashing Recap A processes is busy swapping pages in and out Memory-mapped I/O map a file on disk onto the memory space

More information

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1 Ref: Chap 12 Secondary Storage and I/O Systems Applied Operating System Concepts 12.1 Part 1 - Secondary Storage Secondary storage typically: is anything that is outside of primary memory does not permit

More information

Devices. Today. Comp 104: Operating Systems Concepts. Operating System An Abstract View 05/01/2017. Devices. Devices

Devices. Today. Comp 104: Operating Systems Concepts. Operating System An Abstract View 05/01/2017. Devices. Devices Comp 104: Operating Systems Concepts Devices Today Devices Introduction Handling I/O Device handling Buffering and caching 1 2 Operating System An Abstract View User Command Interface Processor Manager

More information

Storage Systems. NPTEL Course Jan K. Gopinath Indian Institute of Science

Storage Systems. NPTEL Course Jan K. Gopinath Indian Institute of Science Storage Systems NPTEL Course Jan 2012 (Lecture 05) K. Gopinath Indian Institute of Science GetNew(oid) Basic Storage API POSIX: fd=creat(const char *path, mode_t mode) Store(oid, data) POSIX: ssize_t write(int

More information

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Latest Solved from Mid term Papers Resource Person Hina 1-The problem with priority scheduling algorithm is. Deadlock Starvation (Page# 84) Aging

More information

File Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

File Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University File Systems Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE3044: Operating Systems, Fall 2016, Jinkyu Jeong (jinkyu@skku.edu) File System Layers

More information

Input / Output. Kevin Webb Swarthmore College April 12, 2018

Input / Output. Kevin Webb Swarthmore College April 12, 2018 Input / Output Kevin Webb Swarthmore College April 12, 2018 xkcd #927 Fortunately, the charging one has been solved now that we've all standardized on mini-usb. Or is it micro-usb? Today s Goals Characterize

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems DM510-14 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations STREAMS Performance 13.2 Objectives

More information

1 / 23. CS 137: File Systems. General Filesystem Design

1 / 23. CS 137: File Systems. General Filesystem Design 1 / 23 CS 137: File Systems General Filesystem Design 2 / 23 Promises Made by Disks (etc.) Promises 1. I am a linear array of fixed-size blocks 1 2. You can access any block fairly quickly, regardless

More information

Linux Internals For MySQL DBAs. Ryan Lowe Marcos Albe Chris Giard Daniel Nichter Syam Purnam Emily Slocombe Le Peter Boros

Linux Internals For MySQL DBAs. Ryan Lowe Marcos Albe Chris Giard Daniel Nichter Syam Purnam Emily Slocombe Le Peter Boros Linux Internals For MySQL DBAs Ryan Lowe Marcos Albe Chris Giard Daniel Nichter Syam Purnam Emily Slocombe Le Peter Boros Linux Kernel It s big (almost 20 million lines of code) It ll take you YEARS to

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems Silberschatz, Galvin and Gagne 2013! Chapter 13: I/O Systems I/O Hardware" Application I/O Interface" Kernel I/O Subsystem" Transforming I/O Requests to Hardware Operations" STREAMS"

More information

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University Chapter 11 Implementing File System Da-Wei Chang CSIE.NCKU Source: Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University Outline File-System Structure

More information

Roadmap. CPU management. Memory management. Disk management. Other topics. Process, thread, synchronization, scheduling. Virtual memory, demand paging

Roadmap. CPU management. Memory management. Disk management. Other topics. Process, thread, synchronization, scheduling. Virtual memory, demand paging CPU management Roadmap Process, thread, synchronization, scheduling Memory management Virtual memory, demand paging Disk management I/O Filesystem Other topics 1 I/O Heechul Yun Disclaimer: some slides

More information

Conoscere e ottimizzare l'i/o su Linux. Andrea Righi -

Conoscere e ottimizzare l'i/o su Linux. Andrea Righi - Conoscere e ottimizzare l'i/o su Linux Agenda Overview I/O Monitoring I/O Tuning Reliability Q/A Overview File I/O in Linux READ vs WRITE READ synchronous: CPU needs to wait the completion of the READ

More information

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve? What is an Operating System? A Whirlwind Tour of Operating Systems Trusted software interposed between the hardware and application/utilities to improve efficiency and usability Most computing systems

More information

Lecture on Storage Systems

Lecture on Storage Systems Lecture on Storage Systems Storage Systems and OS Kernels André Brinkmann Agenda How can we represent block devices in the kernel and process requests? RepresentaBon of storage systems as block devices

More information

Final Exam Preparation Questions

Final Exam Preparation Questions EECS 678 Spring 2013 Final Exam Preparation Questions 1 Chapter 6 1. What is a critical section? What are the three conditions to be ensured by any solution to the critical section problem? 2. The following

More information

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory Management q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory management Ideal memory for a programmer large, fast, nonvolatile and cheap not an option

More information

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Disk and File System

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Disk and File System ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Disk and File System 1 What Disks Look Like Hitachi Deskstar T7K500 SATA 2

More information

Advanced UNIX File Systems. Berkley Fast File System, Logging File System, Virtual File Systems

Advanced UNIX File Systems. Berkley Fast File System, Logging File System, Virtual File Systems Advanced UNIX File Systems Berkley Fast File System, Logging File System, Virtual File Systems Classical Unix File System Traditional UNIX file system keeps I-node information separately from the data

More information

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals EECS 3221 Operating System Fundamentals Instructor: Prof. Hui Jiang Email: hj@cse.yorku.ca Web: http://www.eecs.yorku.ca/course/3221 General Info 3 lecture hours each week 2 assignments (2*5%=10%) 1 project

More information

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals General Info EECS 3221 Operating System Fundamentals Instructor: Prof. Hui Jiang Email: hj@cse.yorku.ca Web: http://www.eecs.yorku.ca/course/3221 3 lecture hours each week 2 assignments (2*5%=10%) 1 project

More information

Operating Systems Design Exam 2 Review: Spring 2012

Operating Systems Design Exam 2 Review: Spring 2012 Operating Systems Design Exam 2 Review: Spring 2012 Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 Under what conditions will you reach a point of diminishing returns where adding more memory may improve

More information

Linux Filesystems Ext2, Ext3. Nafisa Kazi

Linux Filesystems Ext2, Ext3. Nafisa Kazi Linux Filesystems Ext2, Ext3 Nafisa Kazi 1 What is a Filesystem A filesystem: Stores files and data in the files Organizes data for easy access Stores the information about files such as size, file permissions,

More information

Chapter 12: File System Implementation

Chapter 12: File System Implementation Chapter 12: File System Implementation Silberschatz, Galvin and Gagne 2013 Chapter 12: File System Implementation File-System Structure File-System Implementation Allocation Methods Free-Space Management

More information

Chapter 12: I/O Systems

Chapter 12: I/O Systems Chapter 12: I/O Systems Chapter 12: I/O Systems I/O Hardware! Application I/O Interface! Kernel I/O Subsystem! Transforming I/O Requests to Hardware Operations! STREAMS! Performance! Silberschatz, Galvin

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations STREAMS Performance Silberschatz, Galvin and

More information

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition Chapter 12: I/O Systems Silberschatz, Galvin and Gagne 2011 Chapter 12: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations STREAMS

More information

Sistemi in Tempo Reale

Sistemi in Tempo Reale Laurea Specialistica in Ingegneria dell'automazione Sistemi in Tempo Reale Giuseppe Lipari Introduzione alla concorrenza Fundamentals Algorithm: It is the logical procedure to solve a certain problem It

More information

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester Operating System: Chap13 I/O Systems National Tsing-Hua University 2016, Fall Semester Outline Overview I/O Hardware I/O Methods Kernel I/O Subsystem Performance Application Interface Operating System

More information

What is a file system

What is a file system COSC 6397 Big Data Analytics Distributed File Systems Edgar Gabriel Spring 2017 What is a file system A clearly defined method that the OS uses to store, catalog and retrieve files Manage the bits that

More information

Design Overview of the FreeBSD Kernel CIS 657

Design Overview of the FreeBSD Kernel CIS 657 Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%

More information

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry: Logical Diagram VFS, Continued Don Porter CSE 506 Binary Formats RCU Memory Management File System Memory Allocators System Calls Device Drivers Networking Threads User Today s Lecture Kernel Sync CPU

More information

VFS, Continued. Don Porter CSE 506

VFS, Continued. Don Porter CSE 506 VFS, Continued Don Porter CSE 506 Logical Diagram Binary Formats Memory Allocators System Calls Threads User Today s Lecture Kernel RCU File System Networking Sync Memory Management Device Drivers CPU

More information

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent? Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin

More information

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial) Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin

More information

Operating Systems. Operating Systems Professor Sina Meraji U of T

Operating Systems. Operating Systems Professor Sina Meraji U of T Operating Systems Operating Systems Professor Sina Meraji U of T How are file systems implemented? File system implementation Files and directories live on secondary storage Anything outside of primary

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information

Module 12: I/O Systems

Module 12: I/O Systems Module 12: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Performance Operating System Concepts 12.1 Silberschatz and Galvin c

More information

Linux Operating System

Linux Operating System Linux Operating System Dept. of Computer Science & Engineering 1 History Linux is a modern, free operating system based on UNIX standards. First developed as a small but self-contained kernel in 1991 by

More information

Quiz: Address Translation

Quiz: Address Translation Quiz: Address Translation 8 bits 1 st level 8 bits 8 bits 2 nd level offset Virtual address format (24bits) 4 bits 3 Frame # Unused 1 V Page table entry (8bit) Vaddr: 0x0703FE Paddr: 0x3FE Vaddr: 0x072370

More information

FILE SYSTEMS. Tanzir Ahmed CSCE 313 Fall 2018

FILE SYSTEMS. Tanzir Ahmed CSCE 313 Fall 2018 FILE SYSTEMS Tanzir Ahmed CSCE 313 Fall 2018 References Previous offerings of the same course by Prof Tyagi and Bettati Textbook: Operating System Principles and Practice 2 The UNIX File System File Systems

More information

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed. CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed. File-System Structure File structure Logical storage unit Collection of related information File

More information

File Management 1/34

File Management 1/34 1/34 Learning Objectives system organization and recursive traversal buffering and memory mapping for performance Low-level data structures for implementing filesystems Disk space management for sample

More information

System that permanently stores data Usually layered on top of a lower-level physical storage medium Divided into logical units called files

System that permanently stores data Usually layered on top of a lower-level physical storage medium Divided into logical units called files System that permanently stores data Usually layered on top of a lower-level physical storage medium Divided into logical units called files Addressable by a filename ( foo.txt ) Usually supports hierarchical

More information

I/O Systems. Jo, Heeseung

I/O Systems. Jo, Heeseung I/O Systems Jo, Heeseung Today's Topics Device characteristics Block device vs. Character device Direct I/O vs. Memory-mapped I/O Polling vs. Interrupts Programmed I/O vs. DMA Blocking vs. Non-blocking

More information

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara Operating Systems Christopher Kruegel Department of Computer Science http://www.cs.ucsb.edu/~chris/ Input and Output Input/Output Devices The OS is responsible for managing I/O devices Issue requests Manage

More information