Reminder. COP4600 Discussion 8 Segmentation, File System, Fork() Implementation. Question-1. Discussion 7 Recap. Question-1(cont) Question-1

Similar documents
Reminder. COP4600 Discussion 9 Assignment4. Discussion 8 Recap. Question-1(Segmentation) Question-2(I-node) Question-1(Segmentation) 10/24/2010

Shared Memory. By Oren Kalinsky

COSC Operating Systems Design, Fall Lecture Note: Unnamed Pipe and Shared Memory. Unnamed Pipes

Memory management. Single process. Multiple processes. How to: All memory assigned to the process Addresses defined at compile time

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

File Systems. File system interface (logical view) File system implementation (physical view)

Segmentation with Paging. Review. Segmentation with Page (MULTICS) Segmentation with Page (MULTICS) Segmentation with Page (MULTICS)

CSci 4061 Introduction to Operating Systems. IPC: Message Passing, Shared Memory

File-System. File Concept. File Types Name, Extension. File Attributes. File Operations. Access Methods. CS307 Operating Systems

CS 345 Operating Systems. Tutorial 2: Treasure Room Simulation Threads, Shared Memory, Synchronization

Workloads. CS 537 Lecture 16 File Systems Internals. Goals. Allocation Strategies. Michael Swift

Typical File Extensions File Structure

File Systems: Fundamentals

CSI Module 2: Processes

Interprocess Communication. Originally multiple approaches Today more standard some differences between distributions still exist

File Systems: Fundamentals

Shared Memory Memory mapped files

Part II Processes and Threads Process Basics

Chapter 14: File-System Implementation

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission

Operating Systems, Final exam May 2016 Bachelor's Degree in Computer Science and Engineering

CSE380 - Operating Systems

Inter-process communication (IPC)

ECE 598 Advanced Operating Systems Lecture 18

Chapter 12: File System Implementation

CSE 380: Homework 2: Synchronization

CS 390 Chapter 8 Homework Solutions

CS450/550 Operating Systems

CSE 4/521 Introduction to Operating Systems. Lecture 23 File System Implementation II (Allocation Methods, Free-Space Management) Summer 2018

[537] Fast File System. Tyler Harter

143A: Principles of Operating Systems. Lecture 5: Address translation. Anton Burtsev October, 2018

Operating Systems. IV. Memory Management

File Systems. CS170 Fall 2018

CS4500/5500 Operating Systems File Systems and Implementations

Chapter 4. File Systems. Part 1

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Gabrielle Evaristo CSE 460. Lab Shared Memory

CS 361 Computer Systems Fall 2017 Homework Assignment 4 - Inter-Process Communications & I/O

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

COMP 530: Operating Systems File Systems: Fundamentals

Lecture 19: File System Implementation. Mythili Vutukuru IIT Bombay

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

CS 385 Operating Systems Fall 2011 Homework Assignment 5 Process Synchronization and Communications

Introduction to Virtual Memory Management

Main Points. File layout Directory layout

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

Computer Systems Laboratory Sungkyunkwan University

Structure of Computer Systems

Shared Memory (8A) Shared Memory

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

File Layout and Directories

CS 153 Design of Operating Systems Winter 2016

CS 550 Operating Systems Spring Memory Management: Paging

CS162 - Operating Systems and Systems Programming. Address Translation => Paging"

OS Lab Tutorial 1. Spawning processes Shared memory

CS370 Operating Systems

History. 5/1/2006 Computer System Software CS012 BE 7th Semester 2

File Management 1/34

Memory Management - Demand Paging and Multi-level Page Tables

UNIX File System. UNIX File System. The UNIX file system has a hierarchical tree structure with the top in root.

CS 550 Operating Systems Spring Inter Process Communication

File Systems. Todays Plan

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

Outlook. File-System Interface Allocation-Methods Free Space Management

File Systems. Todays Plan. Vera Goebel Thomas Plagemann. Department of Informatics University of Oslo

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

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables

File System: Interface and Implmentation

Outline. Operating Systems. File Systems. File System Concepts. Example: Unix open() Files: The User s Point of View

Operating Systems 2010/2011

File-System Structure. Allocation Methods. Free-Space Management. Directory Implementation. Efficiency and Performance. Recovery

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

File System Internals. Jo, Heeseung

Operating systems. Lecture 7 File Systems. Narcis ILISEI, oct 2014

Final Examination (Fall 2016) (Section 1)

The Operating System. Chapter 6

COMP 3100 Operating Systems

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

CS370 Operating Systems

Motivation. Operating Systems. File Systems. Outline. Files: The User s Point of View. File System Concepts. Solution? Files!

CS 385 Operating Systems Fall 2013 Homework Assignment 2 Inter-Process Communications and Synchronization

CS 4284 Systems Capstone

FAT (32 KB) 216 * 215 = 231 = 2GB

Discussion Week 10. TA: Kyle Dewey. Tuesday, November 29, 11

TDDB68 Concurrent Programming and Operating Systems. Lecture: File systems

ECE 598 Advanced Operating Systems Lecture 14

PERSISTENCE: FSCK, JOURNALING. Shivaram Venkataraman CS 537, Spring 2019

CS333 Intro to Operating Systems. Jonathan Walpole

Operating Systems, Concurrency and Time. Synchronization and Communication. Johan Lukkien

CS 385 Operating Systems Spring 2013 Homework Assignment 2 Third Draft Inter-Process Communications and Synchronization

e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 35: File Allocation Methods Module No: CS/OS/35 Quadrant 1 e-text

Department of Computer Science and Technology, UTU 2014

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc.

Preview. COSC350 System Software, Fall

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

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

Transcription:

COP4600 Discussion 8 Segmentation, File System, Fork() Implementation TA: Huafeng Jin hj0@cise.ufl.edu Reminder Homework3 is posted on Sakai, it s due one week. Please prepare early. Discussion 7 Recap Assignment 3 C Version Description (IPC producer-consumer) IPC in C (shm: shmget, shmat, shmctl, shmdt) Semaphore in C (sem_init, sem_wait, sem_post) Java Version Description (simulate 3 algorithms, calculate page faults) Page Replacement Algorithms Second Chance (R bit, load time, linkedlist) NRU (R bit, M bit, 4 categories) Aging (R bit, counter, right shift and insert R) Question-1 What does the following programs do? Program1: } char c, *shm, *s; shmid = shmget(key, 27, IPC_CREAT 0666); s = shm; for (c = 'a'; c <= 'z'; c++) *s++ = c; *s = NULL; Question-1 What does the following programs do? Program1: char c, *shm, *s; shmid = shmget(key, 27, IPC_CREAT 0666); s = shm; for (c = 'a'; c <= 'z'; c++) *s++ = c; *s = NULL; } Put 26 letters into a shared memory with key 5678 Question-1(cont) Program 2: } char *shm, *s; shmid = shmget(key, 27, 0666); for (s = shm; *s!= NULL; s++) putchar(*s); putchar('\n'); 1

Question-1(cont) Program 2: } char *shm, *s; shmid = shmget(key, 27, 0666); for (s = shm; *s!= NULL; s++) putchar(*s); putchar('\n'); Get characters from shared memory with key 5678 Question-2 At the following state, using NRU, what happens? 1) Write 5: 2) Read 6: Question-2 At the following state, using NRU, what happens? 1) Write 5: 2) Read 6: vs. paging with paging vs. paging with paging Segmentation Initially, the memory has only one address space : Provide the machine with many logically completely independent address spaces. 2

Segmentation vs. Paging : Programmer is aware of segmentation. Segmentation can be expanded or shrunk. Paging: Programmer is NOT aware of paging. Page size is fixed. Segmentation with paging Virtual memory: Comprised of segments Segment: Comprised of pages For other differences, refer to Figure 3-33 (P238) Segmentation with paging Virtual address format: Segment no. + page no. + offset In virtual space, we have: Page size is 4KB 32 pages Each segment has at most 8 pages How many bits are needed for segment number in the address? How many bits are needed for page number in the address? What is the MULTICS address for 23200? In virtual space, we have: Page size is 4KB 32 pages Each segment has at most 8 pages How many bits are needed for segment number in the address? How many bits are needed for page number in the address? What is the MULTICS address for 23200? Totally 32/8 = 4 segments, so 2 bits for segment no. Each segment has 8 pages, so 3 bits for page no. 23200%4096 = 2720 Seg #: 0, Page #: 5, Offset: 2720 vs. paging with paging 3

File System File A block of resource for storing information based on some durable storage. The basic unit for a file is called block. File operations: create delete open close read write append File System Implementation Methods: Contiguous Allocation Linked List Allocation (File Allocation Table) I-nodes FAT (File Allocation Table) Linked list allocation using a table in memory. : File A: 4, 7, 2, 10, 12 blocks File B: 6, 3, 11, 14 blocks FAT Using FAT, for each block, we have to provide an address. : Disk is 64GB Block size is 16KB What is the memory size to store file allocation table? FAT Using FAT, for each block, we have to provide an address. : Disk is 64GB Block size is 16KB What is the memory size to store file allocation table? Number of blocks: 64GB/16KB = 2 36 /2 14 = 2 22 So the each address takes 22 bits. Memory size: 22 * 2 22 = 92,274,688 bits = 11,534,336 bytes = 11MB I-node : List attributes and disk addresses of the file s blocks. Remember file management system calls: File descriptor table File table I-node table 4

Direct and Indirect fields: Direct and Indirect fields: Direct fields: Records the address of the block Single indirect fields: Records the address of the block that contains the addresses of blocks. Double indirect fields: Records the address of the block that contains the addresses of blocks. Each such block contains address of blocks. Triple indirect fields: Each I-node can store: 12 direct addresses 2 single indirect addresses 1 double indirect address Block size is: 2KB, block address takes 16bits. What is the max file size? Each I-node can store: 12 direct addresses 2 single indirect addresses 1 double indirect address Block size is: 2KB, block address takes 16bits. What is the max file size? 2KB/16bits = 2 11 /2 = 2 10 Each block can hold 2 10 block addresses. Direct address: 12 blocks Single indirect address: 2*2 10 blocks Double indirect address: (2 10 ) 2 blocks (cont) So totally we can hold: 12 + 2*2 10 + (2 10 ) 2 = 1,050,636 blocks 1,050,636* 2KB 2.1GB The maximum file size is 2.1GB Remember: If there is n 0 direct address, 1 single indirect, 1 double indirect, 1 triple indirect, and Assuming N block addresses can fit in a block, then n0 + N + N 2 + N 3 blocks can be hold at most. File Directory Directory: A virtual container of files A file hierarchy: 5

Implement Directories With I-nodes: Each directory has a directory block Directory block: (just like file block) Each entry contains: Directory/file name Pointer to the i-node Implement Directories Structure with directory blocks: Access file f2: For the following file hierarchy: Which blocks do we need to read in order to open f2? 100, 200, 101, 201, 107 If we want to add a new directory d6 under d1, which blocks need to be updated? 201 If we want to add 1 more block to f6, which block need to be updated? 206 vs. paging with paging 6

Fork() Implementation Fork() Implementation Fork(): Creates a new process. Makes a copy of the current process s address space to the new process. Fork(): Creates a new process. Makes a copy of the current process s address space to the new process. Very time consuming, is there a way to delay the copy of the address space? Recap vs. paging with paging Any Questions? 7