Today’s agenda Announcements:

Slides:



Advertisements
Similar presentations
Dynamic Allocation and Linked Lists. Dynamic memory allocation in C C uses the functions malloc() and free() to implement dynamic allocation. malloc is.
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
HW/Study Guide. Synchronization Make sure you understand the HW problems!
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
CSCC69: Operating Systems
The Linux Kernel: Memory Management
CS1061: C Programming Lecture 21: Dynamic Memory Allocation and Variations on struct A. O’Riordan, 2004, 2007 updated.
File System – Unix baed. An entry of Active File table: 1. Access Right: r/w/x 2. Process Count: no. of processes which are now referring to the file.
Day 20 Memory Management. Assumptions A process need not be stored as one contiguous block. The entire process must reside in main memory.
Semaphores and Mailboxes B. Ramamurthy 1. Page 2 Critical sections and Semaphores When multiples tasks are executing there may be sections where only.
Files. System Calls for File System Accessing files –Open, read, write, lseek, close Creating files –Create, mknod.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Computer-System Structures
File System Implementation
CS 140 Lecture Notes: Virtual MemorySlide 1 Load-Time Relocation Process 1 0 ∞ Process 3 Operating System Process 6.
CSE 451 Section 4 Project 2 Design Considerations.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Real-Time Concepts for Embedded Systems Author: Qing Li with Caroline Yao ISBN: CMPBooks.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Windows Object Manager CS Spring Overview The object paradigm NT Objects and the Object Manager Object Structure Object Naming Object Handles.
1-1 NET+OS Software Group Flash API Multiple flash memory bank support New Flash API introduction Detailed Flash API Function presentation Supporting.
7. Pointers, Dynamic Memory 20 th September IIT Kanpur 1C Course, Programming club, Fall 2008.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
Project 2: Initial Implementation Notes Tao Yang.
CE Operating Systems Lecture 17 File systems – interface and implementation.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
CS 3204 Operating Systems Godmar Back Lecture 21.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
3/1/2016Page 1 Realtime System Fundamentals : Scheduling B. Ramamurthy.
ECE 456 Computer Architecture Lecture #9 – Input/Output Instructor: Dr. Honggang Wang Fall 2013.
CS 140 Lecture Notes: Virtual MemorySlide 1 Load-Time Relocation Process 1 0 ∞ Process 3 Operating System Process 6.
Variables Bryce Boe 2012/09/05 CS32, Summer 2012 B.
CS 140 Lecture Notes: Virtual Memory
10 August 2015 Charles Reiss
CS 6560: Operating Systems Design
COT 4600 Operating Systems Fall 2009
Protection of System Resources
CS222/CS122C: Principles of Data Management Lecture #3 Heap Files, Page Formats, Buffer Manager Instructor: Chen Li.
CSCI206 - Computer Organization & Programming
Outline for this evening
CS510 Operating System Foundations
Lecture 45 Syed Mansoor Sarwar
Clear1 and Clear2 clear1(int array[], int size) { int i; for (i = 0; i < size; i += 1) array[i] = 0; } clear2(int *array, int size) {
CS 140 Lecture Notes: Virtual Memory
Circular Buffers, Linked Lists
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy 11/22/2018.
Xinu Semaphores.
Memory Management Chapter 10 11/24/2018 Crowley OS Chap. 10.
Module 2: Computer-System Structures
Array & Pointers CSCE 121 J. Michael Moore.
Lecture 32 Syed Mansoor Sarwar
Handles disk file 0000: array of file-offsets 0001: 0002: 0003: 0: …
Memory Allocation CS 217.
CS 140 Lecture Notes: Virtual Memory
Today’s agenda Lab 1 Module 4: Process Management
Xinu Semaphores.
Module 2: Computer-System Structures
7. Pointers, Dynamic Memory
Distributed Systems CS
CS703 - Advanced Operating Systems
CS510 Operating System Foundations
Today’s agenda ~10min: file system (UNIX) ~1hr: final review + Q&A
Module 2: Computer-System Structures
CSE 451 Section 1/27/2000.
Department of Computer Science
Module 2: Computer-System Structures
CS 140 Lecture Notes: Virtual Memory
Buddy Allocation CS 161: Lecture 5 2/11/19.
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Distributed Systems CS
Presentation transcript:

Today’s agenda Announcements: Oct 29, Mon (lecture by Prof. Fahmy) NO CLASS on Oct 31 (Wed) High-level memory management (Ch10, Module VIII) CS354-Fall2018

Additional slides for High-level memory management CS354-Fall2018

Buffer pool in bufpool.h /* bufpool.h */ #ifndef NBPOOLS #define NBPOOLS 20 /* Maximum number of buffer pools */ #endif #ifndef BP_MAXB #define BP_MAXB 8192 /* Maximum buffer size in bytes */ #define BP_MINB 8 /* Minimum buffer size in bytes */ #ifndef BP_MAXN #define BP_MAXN 2048 /* Maximum number of buffers in a pool */ struct bpentry { /* Description of a single buffer pool */ struct bpentry *bpnext; /* pointer to next free buffer */ sid32 bpsem; /* semaphore that counts buffers */ /* currently available in the pool */ uint32 bpsize; /* size of buffers in this pool */ }; extern bpid32 nbpoolsextern struct bpentry buftab[];/* Buffer pool table */ ; /* current number of allocated pools */ CS354-Fall2018

Allocating a buffer is synchronous /* getbuf.c - getbuf */ #include <xinu.h> /*------------------------------------------------------------------------ * getbuf - Get a buffer from a preestablished buffer pool *------------------------------------------------------------------------ */ char *getbuf( bpid32 poolid /* Index of pool in buftab */ ) { intmask mask; /* Saved interrupt mask */ struct bpentry *bpptr; /* Pointer to entry in buftab */ struct bpentry *bufptr; /* Pointer to a buffer */ mask = disable(); /* Check arguments */ if ( (poolid < 0 || poolid >= nbpools) ) { restore(mask); return (char *)SYSERR; } bpptr = &buftab[poolid]; The process that requests a buffer will be blocked until the request is satisfied. CS354-Fall2018

Getbuf() does not return the buffer address to the caller (why?) /* Wait for pool to have > 0 buffers and allocate a buffer */ wait(bpptr->bpsem); bufptr = bpptr->bpnext; /* Unlink buffer from pool */ bpptr->bpnext = bufptr->bpnext; /* Record pool ID in first four bytes of buffer and skip */ *(bpid32 *)bufptr = poolid; bufptr = (struct bpentry *)(sizeof(bpid32) + (char *)bufptr); restore(mask); return (char *)bufptr; } Getbuf() does not return the buffer address to the caller (why?) Getbuf() stores the pool ID in the first four bytes of the allocated space and return the address just beyond the ID. CS354-Fall2018

Returning buffers to the pool /* freebuf.c - freebuf */ #include <xinu.h> syscall freebuf( char *bufaddr /* Address of buffer to return */ ) { intmask mask; /* Saved interrupt mask */ struct bpentry *bpptr; /* Pointer to entry in buftab */ bpid32 poolid; /* ID of buffer's pool */ mask = disable(); /* Extract pool ID from integer prior to buffer address */ bufaddr -= sizeof(bpid32); poolid = *(bpid32 *)bufaddr; CS354-Fall2018

if (poolid < 0 || poolid >= nbpools) { restore(mask); return SYSERR; } /* Get address of correct pool entry in table */ bpptr = &buftab[poolid]; /* Insert buffer into list and signal semaphore */ ((struct bpentry *)bufaddr)->bpnext = bpptr->bpnext; bpptr->bpnext = (struct bpentry *)bufaddr; signal(bpptr->bpsem); return OK; CS354-Fall2018

Other codes Creating a buffer pool (mkbufpool.c) Initializing the buffer pool table (bufinit.c) CS354-Fall2018

Virtual Memory Prof Comer’s slide CS354-Fall2018