Question: TIPS Your code should be written in C and buildable under Linux. An example handle is a file descriptor'. These handles start at a value

 TIPS Your code should be written in C and buildable underLinux. An example handle is a "file descriptor'. These handles start at

TIPS Your code should be written in C and buildable under Linux. An example handle is a "file descriptor'. These handles start at a value of O and increment as more descriptors are allocated and handed out GETTING A 'HANDLE' ON THINGS Sometimes the most mundane elements of an OS are some of the most interesting! Operating systems need to So, if a handle isn't a pointer, provide handles that refer to what is it? It's typically a unique internal data objects as part of key that represents an providing services to common association with a specific data functionality (like opening a file). object. In an Os, a file descriptor It's quite possible you've never (which is just an integer) through much about this basic represents a reference tothe operation but it's a critical aspect data holding the context and of Oses. For example, when an current position of a file object. application calls the OS function As it turns out, how these open() (in C), a unique identifier is handles are created, associated, allocated and that value now managed and retired is critical to represents a complex data OS performance. Operating structure in the OS (a file Systems need to be able to descriptor). This unique identifier create, lookup and retire handles is then used in further system calls for a wide range of subsystems such as reading or writing data. very quickly and scale to support These kinds of handles allow all the requests from the software an OS to keep its internal data running in the system structures opaque and protected As an exercise, you are to from direct manipulation through design a set of APIs and the API. It also provides flexibility implement a subsystem that will to grow when decoupling alow for the creation, query and references from memory objects destruction of handles that can such as accessing objects over a be used to reference the data network where pointers would objects bound to them. How you fail. Additionally, the memory an create, store, lookup and delete Os uses for its data isn't often the these handles and associate same as the memory that an data objects with them is entirely application has access, so there up to you. is no way to directly interact with internal memory objects. It's helpful to reuse any handles after they're returned so that the handle space is kept compact and doesn't get too large. Operating systems allocate identifies for lots of different kinds of services such as file operations, page caches, timers etc so performance is key You should include some example usage demonstrating your implementation is working and explain your design and data structure choices. EXAMPLES AND CLAIRIFCATIONS FAKE IMPLEMENTATION OF MYOS_OPEN() The following pseudo-code blocks are only to provide an illustrative idea of the assignment. int myos_open(const char* filename, unsigned int mode_type) { struct file_object *fobj: int new_handle; The exercise does not require the use of files or storage of any kind as we're focused on creating a sub- system that can associate opaque handles to specific data strutures and not not storing the data itself. /* look up the filename in our filesystem and get the associated internal data struct reference */ if ((fobj=search_filesystem (filename)) == NULL) { errno = ENOENT; /* no such file */ return -1; } /* bind handle and data object */ if ((new_handle = create_new_handle(fob,mode_typej))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!