Project

1. Understanding Relevant Code

Refer to operating system and the links given in reference section of each page.

LInk to the book

2. Design

There are two ways in which immediate files can be implemented in the minix operating system -
Static : In this approach, the maximum file size is specified at creation and you can't change the type of file once created. In case the immediate file size exceeds the specified size, it will report an error. This is can be implemented by creating a new file system.
Dynamic : A file is created as an immediate file and if size exceeds specified size, it becomes a regular file. To implement this approach, we need to make changes in the existing file system.
Implementation in Dynamic Approach: To include immediate file system in an existing file system, the following sections are involved - Data structures representing files Virtual File System Message Formats Minix File System : in the funtions of the regular file system of minix, there is almost no change in create, open and close functions. The changes in read, write, delete are made so that if the file is immediate (which can be deduced by comparing size), then there is the content is to be accessed from the inode.

3. Tutorials for Basic Understanding

  1. http://homepages.cs.ncl.ac.uk/nick.cook/csc2025/minix/
  2. http://homepages.cs.ncl.ac.uk/nick.cook/csc2025/minix/familiarisation.html
  3. https://diuf.unifr.ch/pai/education/2004_2005/courses/OS/04_Minix_01

4. Installation and setting up the system

5. Algorithm

Algorithm

6. Final Implementation - Coding

File System Basic Structure

The /usr/src/servers/mfs directory contains the source code for FS in minx3.2 operating system. Some of the important files in mfs are main.c, in- ode.h, open.c, write.c, buf.h, super.h, super.c etc. The main function of each file in mfs are listed below:

Data Structures Involved

Inode

we can see that there are 7 zones of 4 bytes each, an indirect zone of size 4 bytes, a double indirect node of size 4 bytes and an unused space of 4 bytes. Each zone points to a disk block where actual data gets stored. According to definition of immediate files we had to find a space in the inode where we can store the immediate files. These zones are apt place to store the immediate files because no data which is critical to the file is being affected. We calcualted maximum size of immediate files as 40 bytes by adding up sizes of all zones, indirect zones and unused space.

max size = zn sz X 7 + ud sz + idt sz + ddt sz
max size = 4 X 7 + 4 + 4 + 4 = 40bytes

buffer or block cache

This is a union of different types of blocks in the disk. Eg. normal data block, directory block, inode block, bitmap block etc. The design of buffer or block cache is given below.

b_data array is used to cache the data which is stored in the disk block, all the modifications by the user are done here and then the data is written back to the disk. b data(b) is a macro which returns the pointer to the first byte of b data array.

message

mess 1, mess 2, mess 3, . . . are different message types. In MFS, global variables, fs m in and fs m out, of type message are used to send and recieve messages from various servers like VFS. Following system calls are used for message passing: echo, notify, sendrec, receive, send.

Files Involved

List of all files in which codes are added or deleted.