What is difference between symbolic and hard links to files

Assignment Help Operating System
Reference no: EM131709693

Operating Systems Assignment

1. What is the difference between symbolic and hard links to files? On the os server, What happens when you try to create a symbolic link in /temp to a file that is in your home directory? How about a hard link? Explain what happens.

2. A UNIX file system has 4096-byte blocks (this is typical) and 4-byte disk addresses. What is the maximum file size if i-nodes contain 100 direct entries, and one single and one double indirect entry? What happens when you add one triple indirect entry?

3. Using the stat utility on the os server, what can you say about how renaming a file differs from copying a file and deleting the old one, and how copying a file to a different directory differs from moving the file there?

4. One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk every time a file is removed. Since all files are contiguous, copying a file requires a seek and rotational delay to read the file, followed by the transfer at full speed. Writing the file back requires the same work. Assume you have a modern disk with an average seek time of 15 msec, operates at 7200RPM, and has a transfer rate of 6 Gbps. If the average file size is 16 KB, how long does it take to read a file into main memory and write it back to a new location? (Assume no prefetching and cold caches.) How long would it take to compact half of a 2 TB disk?

5. How many disk operations are needed to fetch the i-node for the file /dir1/dir2/dir3/myfile? Assume that the i-node for the root directory is in memory, but nothing else along the path is in memory. Also assume that all directories fit in one disk block.

6.

(a) Write a C program that reverses the bytes of a given arbitrary length file and outputs them to another specified file, which should be overwritten if it already exists. So, invoking your program as follows

./reverse infile outfile

will result in the first byte of outfile being the last byte of infile, and so on until the last byte of outfile is the first byte of infile. The given filenames are just an example, make your own infile. You must use fseek()/fread()/fwrite().

(b) Write another C program that reverses the bytes of a given arbitrary length file in-place, as in, the contents of the file are swapped without a temporary file and without producing a second file. Use mmap(). E.g. ./reverse2 infile results in the contents of infile being reversed after the call, and calling ./reverse2 infile twice should result in the same file as you started with.

(c) Compare the performance of ./reverse with ./reverse2. Use the timing function below to target your timing to just the portion of the program which actually does the reversing and produces output. Get the averages of a bunch of runs.

#include <sys/time.h> #include <unistd.h> #include <assert.h>

// you may use this to convert the contents of the timeval struct to ns long nanosec(struct timeval t){
return((t.tv_sec*1000000+t.tv_usec)*1000);
}

int main(){ int res;
struct timeval t1, t2;

res=gettimeofday(&t1,NULL); assert(res==0);
//stuff you want to measure might go here res=gettimeofday(&t2,NULL); assert(res==0);
//find average time here
}

7. Write a wc utility that takes in a single filename as an argument, and computes the number of characters, words, and lines present in that file. Now, have this wc store the name of the input file, and numbers of characters, words, and lines in a binary file (put all the information you're going to save into a struct, then write that struct out to a file); call the file wc.saved. Each time this wc is invoked from the command line, and only if the input file exists and is readable, use explicit file I/O to add the file's information to wc.saved if that file's information is not already present in wc.saved. If information about the file already exists use mmap to edit its entry to reflect the latest counts. Add a -p option to your program so that invoking wc -p prints all the collected data out of wc.saved (reasonably formatted, of course).

Reference no: EM131709693

Questions Cloud

Find the adjusted multiple coefficient of determination : A study of Dutch tourism behavior included a regression analysis using a sample of 713 respondents. The dependent variable, number of miles traveled.
Predict firm governance level by multiple regression model : A multiple regression model was developed for predicting firms' governance level, measured on a scale, based on firm size, firm profitability.
Compare the domestic terrorism and international terrorism : Please explain in detail which agency you think should be the lead agency within the intelligence community. Why did you choose this agency?
Attacks that malicious hackers : We've been talking about the various forms of attacks that malicious hackers can use to compromise security this week. Search on the Internet
What is difference between symbolic and hard links to files : What is the difference between symbolic and hard links to files? How copying a file to a different directory differs from moving the file there?
Network firewall comparison : Use Internet to research the status of network firewalls. Identify a three different network firewall products. Do not need to create table
It project management : Research articles and tools on project portfolio management. Summarize the advantages of performing project portfolio management as well as challenges.
How do you feel about your life : How do you feel about your life? Make a list of rewards that are meaningful to you. List the positive aspects of your life. What would you like to change?
Predict firm reputation on the basis of unexpected accruals : A regression analysis was carried out to predict a firm's reputation (defined on a scale called the Carter-Manaster reputation ranking) on the basis.

Reviews

Write a Review

Operating System Questions & Answers

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd