a. Consider the following page reference string:
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6
Using the above page reference string display the contents of the frames and marking when a page fault occurs after each page reference (cf. Figures 9.12, 9.14, or 9.15 of the text).
Use the following algorithms
• LRU replacement
• FIFO replacement
• Optimal replacement and assume 3 frames. Repeat using 4 frames.
Remember that all frames are initially empty, so the first unique pages will cost one fault each. The VAX/VMS system uses a FIFO replacement algorithm for resident pages and a free-frame pool of recently used pages. Assume that the free-frame pool is managed using the least recently used (LRU) replacement policy. Answer the following questions:
(i) If a page fault occurs and if the page does not exist in the free-frame pool, how is free space generated for the
newly requested page
(ii) If a page fault occurs and if the page exists in the freeframe pool, how is the resident page set and the freeframe pool managed to make space for the requested page
(iii) What does the system’s paging algorithm reduce to if the number of resident pages is set to one
(iv) What does the system’s paging algorithm reduce to if the number of pages in the free-frame pool is zero
Answer the following questions:
a. Unix has the concept of a “hard link” and a “soft link”. Explain what a “link” is, and how the file system implements both types of links.
Answer the following questions:
a. Consider the following I/O scenarios on a personal computer running a multi-tasking operating system:
(i) A mouse used with a graphical user interface.
(ii) A tape drive (assume no device preallocation is available).
(iii) A disk drive containing user files.
(iv) A graphics card with a direct bus connection, accessible through memory-mapped I/O For each of these I/O scenarios, would you design the operating system to use buffering, spooling, caching, or some combination Would you use polled I/O, or interrupt-driven I/O Give reasons for your choices.
b. The open-file table is used to maintain information about files that are currently being accessed by processes. Should the operating system maintain a separate table for each process or just maintain one table that contains references to files that are being accessed by all processes at the current time,or use both types of tables? Justify your answer.
What are the steps required to be performed by the Ext2 file system kernel module to create a new file that contains 4000 bytes of data Assume that a copy of the directory inode the file is to be created in is already in memory. Also assume the block size is 1024 bytes.Either list the steps required or use a flowchart. (See the week 11 practical for information on the Ext2 file system and examples of listing the required steps or writing a flowchart).
- 3 Frames
LRU Replacement
1 |
2 |
3 |
4 |
2 |
1 |
5 |
6 |
2 |
1 |
2 |
3 |
7 |
6 |
3 |
2 |
1 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 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
- When the required page is not available in the free-frame pool then one of the least recently used page from the pool is removed and then the required page is moved from disk to free-frame pool and then to the resident set.
- When the required page is in free frame pool then the required page is moved from free frame pool to resident pages and one of the resident page based on FIFO replacement is moved from resident page to the free frame pool
- When the number of resident pages is set to 1 then system’s paging algorithm used will be free-frame pool paging algorithm. As the free frame pool paging algorithm is LRU the system’s paging algorithm reduces to LRU
- When the free-frame pool size is zero, the system’s paging algorithm is resident pages algorithm. As the resident pages paging algorithm is FIFO. The system’s paging algorithm reduces to FIFO
- In UNIX, all the files maintain a data structure called i-node. I-node stores the details about the file. The filenames are used to refer to the data structure whereas the link refers to the contents of a file. Generally two types of links are used:
- Hard link:
Hard link is used to just point to i-node of the file. For example consider a file a.txt that contains the text “This is sample test”. A hard link is constructed in UNIX with the ln command. A hard link to a.txt is created as follows:
ln a.txt b.txt
Now both a.txt and b.txt refer to the same i-node.
Modification done through one of the file name will be reflected in other file too as both a.txt and b.txt points to the same file.
- Soft link:
Soft link or symbolic link is a file that holds the name of another file. The contents of the file can be accessed with the help of the symbolic link name too. The soft link can be created in UNIX as
ln –s a.txt symB.txt
Now the symB.txt contains the filename a.txt. The file can be accessed by both a.txt and symB.txt. Modification done through one file will be reflected in other too.
This looks similar to hard link but when the file a.txt is remove using rm command the file becomes no longer accessible through the soft link symB.txt whereas the file is still accessible via b.txt the hard link of a.txt as b.txt directly points to the file content
- When copying the file to USB, the UNIX sometimes follows the delayed writing. Sometime UNIX not always writes data to disk at the time it is requested to do so. It just copies the data and store in memory. When we unmounts the disk the operating system makes sure whether all data are properly written to the disk and makes the pending write operation.
In UNIX file metadata is copied synchronously but the contents of the file are copied asynchronously because the metadata stores the file details and is of very less in storage. So the synchronous write of metadata completes soon and then the process can move to the next task. But as the file contents are large and the CPU is busy in other operation, OS just copies the data to kernel buffer and return the asynchronous write process. When CPU turns free or when forced to do so through unmounts it copies the data from kernel buffer to USB.
- Buffering is required to record the movement of the mouse when the operation of high priority is running. For mouse the spooling and caching are not required. Interrupt driven I/O is more appropriate as the mouse is the input device.
- For a tape drive all the mechanism buffering, spooling, and caching are required. Buffering is required to manage the throughput difference between the tape drive and the source or tape drive and the destination. Cache grasps the copy of the data in the tape and used for the faster access of data. Spooling is used in multi user environment when multiple users read or write data on the same time. For tape drive interrupt-driven I/Os performance is best.
- For a disk drive, Buffer holds the data while transferring data from disk to user space and vice versa. The cache holds the data in the disk for faster access. As the disk drive allows shared access spooling is not necessary. As the disk drive transfer rate is slow the interrupt driven I/O shows best performance.
- For graphic card buffering is required to store the next screen image when the current one displays. As the graphics card is the fast and shared access device caching and spooling is not required. For memory mapped device neither polling nor interrupt driven IO is required.
- If one table contains the reference of all the files currently accessed by all the process, if a file is accessed by more than one process and if one process deletes the file it is required that the file should not be removed until all the process accessing the particular file closes the file. This mechanism can be implemented only if a centralized accounting system is implemented that tracks the number of process using the file. As it is tough it is better to implement separate file table for each process that maintains the part of the file that is accessed by the process.
To create a new file of 4000 bytes of data in ext2 containing block size of 1024 bytes requires at-least 4 blocks (4000/1024). The steps to create new file is shown below:
- Determine the root inode
- Determine the filename
- Identify the inode’s block group
- Write a 1024 data
- Increment the inode block number storage location
- Determine the next the block to write the data from inode
- Write the data
- Continue this process until all 4 block of data is written with data.
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2021). Operating System I/O Scenarios And File Links In Unix. Retrieved from https://myassignmenthelp.com/free-samples/csc2404-operating-system/data-structure.html.
"Operating System I/O Scenarios And File Links In Unix." My Assignment Help, 2021, https://myassignmenthelp.com/free-samples/csc2404-operating-system/data-structure.html.
My Assignment Help (2021) Operating System I/O Scenarios And File Links In Unix [Online]. Available from: https://myassignmenthelp.com/free-samples/csc2404-operating-system/data-structure.html
[Accessed 18 December 2024].
My Assignment Help. 'Operating System I/O Scenarios And File Links In Unix' (My Assignment Help, 2021) <https://myassignmenthelp.com/free-samples/csc2404-operating-system/data-structure.html> accessed 18 December 2024.
My Assignment Help. Operating System I/O Scenarios And File Links In Unix [Internet]. My Assignment Help. 2021 [cited 18 December 2024]. Available from: https://myassignmenthelp.com/free-samples/csc2404-operating-system/data-structure.html.