Ask a question from expert

Ask now

Creating a User-Space Device Driver for a Hierarchical Random Access Memory System

8 Pages2082 Words155 Views
   

Added on  2019-09-16

About This Document

This article provides instructions for creating a user-space device driver for a hierarchical random access memory system (HRAM). It includes details on the file operations that need to be implemented, such as read, write, open, close, and seek. The article also explains the structure of the HRAM system and how to communicate with it using opcodes and packed registers. Additionally, it offers an honors option for implementing three different frame allocation strategies. Sample workload files are provided for testing the program.

Creating a User-Space Device Driver for a Hierarchical Random Access Memory System

   Added on 2019-09-16

BookmarkShareRelated Documents
1st partAll remaining assignments for this class are based on the creation andextension of a user-space device driver for a in memory filesystem thatis built on top of a hierarchical random access memory system (HRAM).At the highest level, you will translate file system commands intomemory frame level memory operations (see memory interfacespecification below). The file system commands include open, read,write, seek and close for files that are written to your file systemdriver. These operations perform the same as the normal UNIX I/Ooperations, with the caveat that they direct file contents to the HRAMstorage device instead of the host filesystem. The arrangement ofsoftware is as follows:System and Project OverviewYou are to write a basic device driver that will sit between a virtualapplication and virtualized hardware. The application makes use of theabstraction you will provide called HRAM "cartridge" memory system(CART). The design of the system is shown in the figure to the right:
Creating a User-Space Device Driver for a Hierarchical Random Access Memory System_1
Described in detail below, we can see three layers. The CARTapplication is provided to you and will call your device driver functionswith the basic UNIX file operations (open, ...). You are to write thedevice driver code to implement the file operations. Your code willcommunicate with a virtual controller by sending opcodes and dataover an I/O bus.All of the code for application (called the simulator) and CART memorysystem is given to you. Numerous utility functions are also provided tohelp debug and test your program, as well as create readable output.Sample workloads have been generated and will be used toextensively test the program. Students that make use of all of thesetools (which take a bit of time up front to figure out) will find that thelater assignments will become much easier to complete.The Cartridge Memory System Driver(CART)You are to write the driver that will implement the the basic UNIX fileinterface using the memory system. You will write code to implementthe filesystem, and make several design decisions that will determinethe structure and performance of the driver. In essence you will writecode for the read, write, open, close and other high level filesystemfunctions. Each function will translate the call into low-level operationson the device (see below).The functions you will implement are:int32_t cart_poweron(void);- This function will initialize the CARTinterface basic filesystem. To do this you will execute the initCART opcode and zero all of the memory locations. You will alsoneed to setup your internal data structures that track the state ofthe filesystem.int32_t cart_poweroff(void);- This function will show down theCART interface basic filesystem. To do this you will execute theshutdown CART opcode and close all of the files. You will alsoneed to cleanup your internal data structures that track the stateof the filesystemint16_t cart_open(char *path);- This function will open a file(named path) in the filesystem. If the file does not exist, it shouldbe created and set to zero length. If it does exist, it should beopened and its read/write postion should be set to the first byte.Note that there are no subdirectories in the filesystem, just files(so you can treat the path as a filename). The function should
Creating a User-Space Device Driver for a Hierarchical Random Access Memory System_2
return a unique file handle used for subsequent operations or -1if a failure occurs.int16_t cart_close(int16_t fd);- This function closes the filereferenced by the file handle that was previously open. Thefunction should fail (and return -1) if the file handle is bad or thefile was not previously open.int32_t cart_read(int16_t fd, void *buf, int32_t count);- Thisfunction should readcountbytes from the file referenced by thefile handle at the current position. Note that if there are notenough bytes left in the file, the function should read to the endof the file and return the number of bytes read. If there areenough bytes to fulfill the read, the function should returncount.The function should fail (and return -1) if the file handle is bad orthe file was not previously open.int32_t cart_write(int16_t fd, void *buf, int32_t count);- Thefunction should writecountbytes into the file referenced by thefile handle. If the write goes beyond the end of the file the sizeshould be increased. The function should always return thenumber of bytes written, e.g.,count. The function should fail (andreturn -1) if the file handle is bad or the file was not previouslyopen.int32_t cart_seek(int16_t fd, uint32_t loc);- The function shouldset the current position into the file toloc, where 0 is the firstbyte in the file. The function should fail (and return -1) if the locis beyond the end of the file, the file handle is bad or the file wasnot previously open.The key to this assignment if figuring out what you need to do toimplement these functions. You are specifically not given guidance onhow to do it. You need to (a) maintain information about current files inthe file system, (b) allocate parts if the memory system to place data,(c) copy data into and out of the memory system as needed to servereads and writes. How you do this is up to you, but think carefull aboutit before beginning to code. What is important is that the code youwrite will be built upon the whole semester.The Cartridge Memory System (CART)You will implement your driver on top of the CART memory system(which is referred to throughout simply as the CART). The CART is ahierarchical memory system, which means that there are multiplelevels of memory organization. In the case of the CART, there are threelevels: the system as a whole consists of multiple cartridges, each ofwhich contain multiple frames. Each frame is a fixed byte sized
Creating a User-Space Device Driver for a Hierarchical Random Access Memory System_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Operating System Case Study 2022
|10
|1528
|38

Operating system - Sample Assignment
|6
|1203
|31

Python Programming: Research Report
|7
|2904
|737

Ping Pong
|12
|647
|318

Assembly Language with Research and Analysis
|25
|2274
|12

Computer Software: Types, Responsibilities, Installation and Troubleshooting
|4
|594
|180