A file system has a root directory containing two entries: homestar and strong, both directories. The homestar directory contains an entry for a regular file named txt. We can represent the current state of the system as follows:file #     type           contents------     ----           --------1         directory     . -> 1                              .. -> 1                              homestar -> 2                              strong -> 32         directory     . -> 2                               .. -> 1                              txt -> 43         directory     . -> 3                              .. -> 14         regular file   (contents of file) The symlink system call creates a directory entry that contains the path name of the file being linked to, rather than a file number. For example, after executing symlink(/homestar, /strong/mad), The contents of directory 3 would look like this:3        directory     . -> 3                              .. -> 1                              mad -> /homestarShow the changes to the state of the file system after each of the following operations is executed in succession.link(/homestar/runner.txt, /strong/bad.txt)symlink(/homestar/runner.txt, /strong/sad.txt)unlink(/homestar/runner.txt)mkdir(/trogdor)create(/trogdor/burninator.txt)

Question
Asked Nov 23, 2019
66 views
  1. A file system has a root directory containing two entries: homestar and strong, both directories. The homestar directory contains an entry for a regular file named txt. We can represent the current state of the system as follows:
  • file #     type           contents
    ------     ----           --------
    1         directory     . -> 1
                                  .. -> 1
                                  homestar -> 2
                                  strong -> 3

    2         directory     . -> 2
                                   .. -> 1
                                  txt -> 4

    3         directory     . -> 3
                                  .. -> 1

    4         regular file   (contents of file)

 

  • The symlink system call creates a directory entry that contains the path name of the file being linked to, rather than a file number. For example, after executing symlink(/homestar, /strong/mad), The contents of directory 3 would look like this:
  • 3        directory     . -> 3
                                  .. -> 1
                                  mad -> /homestar
  • Show the changes to the state of the file system after each of the following operations is executed in succession.
    • link(/homestar/runner.txt, /strong/bad.txt)
    • symlink(/homestar/runner.txt, /strong/sad.txt)
    • unlink(/homestar/runner.txt)
    • mkdir(/trogdor)
    • create(/trogdor/burninator.txt)
check_circle

Expert Answer

Step 1

(a)

$ ln homestar/runner.txt strong/bad.txt

$ ls -al
total 16
.                    1
..                  1
homestar    2
strong           3

$ ls -al homestar
total 12
.                     2
..    1

runner.txt        4
$ ls -al strong
.                     3
..                    1
bad.txt            5

As soon as we add a hard link , a unique entry for bad.txt is seen in strong directory with unique number as “5”.

Step 2

(b)

$ ln -s homestar/runner.txt strong/sad.txt

$ ls -al strong
.                                                  3
..                                                 1
bad.txt                                        5
sad.txt -> homestar/runner.txt 6

An entry for sad.txt which links to homestar/runner.txt is made in strong directory with unique number as “6” .

$ ls -al homestar
.                                                   2
..                                                  1
runner.txt                                     4

Step 3

(c)

$ unlink homestar/runner.txt

$ ls -al homestar
.                                                2
..                                                1

Entry for homestar/runner.txt is removed from homestar.

$ ls -al strong
.                     ...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: Suppose you want to build a program using WebGL that draws two kinds of objects - shiny billiard bal...

A: Drawing multiple objects in WebGLIn order to draw two kinds of objects in WebGL, first call function...

question_answer

Q: ABC Accounting Company is a company that manages the financials for various small companies on a nat...

A: 1) To prevent remote employees from being hacked, the following steps can be taken:A Virtual private...

question_answer

Q: Forest and domain functional level means Windows Operating System version. which one applies? Member...

A: Explanation:A Windows Server 2008 functional level requires that all the Domain Controller (DC)s mus...

question_answer

Q: Excel Project How do create a formula to calculate daily totals in dollars. Multipy the value in the...

A: Excel is a software program developed by Microsoft. Excel has an electronic spreadsheet to organize ...

question_answer

Q: DISCUSS THE BLOCKCHAIN TECHNOLOGY?

A: What is BLOCKCHAIN: ⦁ As its name suggests, its a chain of blocks or a growing list of records (reco...

question_answer

Q: "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the...

A: Program Algorithm-STARTStep1:Import the essential headers.Step2: Declare the main function.Step3: De...

question_answer

Q: 3. Write a program that deliberately contains an endless or infinite while loop. The loop should gen...

A: Following is the java program:variables used:z is used to store the result of the multiplication of ...

question_answer

Q: For the following problems assume 1 kilobyte (KB) 1024 kilobytes. 1024 bytes and 1 megabyte (MB) For...

A: a) Bits in offset = log2(page size)Given, every byte in the page have a unique address so we have co...

question_answer

Q: Using the code in part I of this lab (included below): 1. Create a function to INPUT the information...

A:  Create a function INPUT which takes a structure variable as parameter.Pass structure variable using...