Site icon Tutor Bin

Home Network Architecture Question

Home Network Architecture Question

Description

If you used something other than the textbook or Linux manual pages to a significant extent, that is ok, just cite where you got your information from. Answers should be in your own words in any case, not text pasted in verbatim from the book or other materials.

Part 1: Written questions on the course material

This section asks questions that can be answered from the material covered in the textbook and lectures.

Processes

1. When a process is first started, it enters the Ready state. Why doesn’t it start in the Running state instead?

2. When a Running process asks the operating system to open a file, what state does the process transition to?

3. There are three states in the process model the book covers: Running, Ready, and Blocked. If we just look at the combinatorial possibilities, there should be six possible transitions between three states (A→B, B→A, A→C, C→A, B→C, C→B). However only four transitions are actually possible in this process model, while two transitions cannot happen. Which two transitions are impossible?

4. Why are the two transitions you identified in #3 not possible?

5. Modern CPUs have a timer interrupt. What is the purpose of this interrupt?

6. It is possible to do task switching without a timer interrupt (early Macintoshes are one example of an operating system that did this). What is this approach to process switching called?

7. What is the difference between kernel mode and user mode?

8. What is the purpose of a system call? And how does it relate to the difference between user mode vs. kernel mode?

For questions 9-14, consider three jobs that arrive as follows: One job arrives at time 0 and will take 50ms to complete. A second job arrives at time 10ms and will take 10ms to complete. A third arrives at time 20ms and will take 50ms to complete.

9. Draw a figure showing which jobs will execute at which times if we use a first-in first-out (FIFO) scheduler. (See the figures in Chapter 7 for examples of what this figure should look like.)

10. What is the average turnaround time of the FIFO scheduler in this case?

11. Draw a figure like #9, but using a shortest time to completion first (STCF) scheduler instead.

12. What is the average turnaround time of the STCF scheduler in this case?

13. Is the average turnaround time in #12 optimal, i.e. as short as possible?

14. Draw a figure for how these jobs would be scheduled using a multi-level feedback queue (MLFQ) scheduler with the following settings: 3 queues, quantum length of 10ms, and no priority boost. (See the figures in Chapter 8 for examples of how this should look.)

Virtual memory

15. In addition to the process abstraction, a core responsibility of a modern operating system is abstracting memory. This is done through the virtual memory system. What hardware support is needed for a virtual memory system to work efficiently?

16. A simple virtual memory system, without segments, is called the “base and bounds” approach. Briefly summarize what the relationship is between virtual addresses and physical addresses in such a system.

17. Consider a base-and-bounds virtual memory system that puts a process into physical memory, starting at address 1000. If the program tries to read from virtual address 5, which physical address will be read from?

18. What if we made the base-and-bounds system even simpler, and had only a base, not a bound. What problem could that cause?

19. What is the difference between a segmented memory system and the base-and-bounds system?

20. What additional hardware support is needed for segmented memory?

21. One way of managing free memory space is called “best fit”. However, it is not often used in practice. Why not?

22. If free memory space is not managed well, memory can become fragmented. Why is fragmented memory a problem?

File systems

23. Linux file systems have three kinds of file permissions: read, write, and execute. For a regular file, “execute” means what it says, that the file can be run as an executable program. What does the “execute” permission mean for a directory?

24. Consider a file with permissions rw-r--r--. Who is allowed to write to this file?

25. Is it possible to set a directory’s permissions so that nobody, not even the owner, can enter it? If yes, explain how. If no, explain why not.

Part 2: Exercises on the class Linux server

To complete this section, you need to log in to the class Linux server. You’ll be asked to exercise some of the hands-on Linux command line skills you learned in this class, as well as the C interface provided by the operating system.

1. Copy the files /home/ubuntu/memory-user.c and /home/ubuntu/memory-user2.c to your home directory. The first one, memory-user.c, should look similar to the program you wrote for Homework 4. The second one, memory-user2.c, has the same functionality, but has added error checking to avoid crashing with a segmentation fault when given invalid input.

2. There are two kinds of crashes that are possible in memory-user, but which memory-user2 will check for and exit before they happen. What are the two kinds of crashes?

3. Compile the two programs. Find examples of two command lines that will cause memory-user to crash but not memory-user2, one for each of the two kinds of possible crashes.

4. On which two lines of code in memory-user.c do the actual crashes happen?

5. The tool diff shows differences between two files. Run diff memory-user.c memory-user2.c to see exactly which lines of code changed between the two versions of memory-user. Now run it again, but redirect the output to a file named diff.txt in your home directory, and leave it there (I’ll check that the file exists to give you points for this question).

6. Some people prefer an alternative diff output format, called a “unified diff”, which is produced when you use the -u flag. What is the difference between the default diff format and the unified diff format? To see the unified diff output, run: diff -u memory-user.c memory-user2.c

7. Copy memory-user2.c to a new file, memory-user3.c. Modify it so that memory-user3 will refuse to allocate more than 100 megabytes of memory.

8. Copy the file /home/ubuntu/access.c to your home directory. What does this program do? You have probably not seen the access() system call before. You can read the manual page for it by typing: man access

9. Compile and run the program. You should observe that it has two possible outputs, 0 and -1. Give an example of a command line that produces 0, and a command line that produces -1.

10. The manual page says: “the use of this system call should be avoided”. Why should it be avoided?

Part 3: Articles on recent OS features

This section asks you to read two short articles on features that have recently been added to two operating systems, and answer some questions about them, based on both the articles and your knowledge of operating systems. You are not expected to already know the material in the articles, or to understand every detail. But you hopefully now know enough operating system concepts to be able to read articles like these and understand the important points. Hey, that’s exciting! 🙂

Article A: “Core scheduling” in Linux

This article describes a new, optional scheduling system that was added to Linux last year:

Questions:

1. Why is the SMT feature of modern processors a security problem for cloud providers?

2. What was the motivation for developing Linux’s new “core scheduling” feature, instead of solving the security problem by just turning off SMT?

3. Briefly summarize how the core scheduling feature solves the security problem discussed in question 1, even when SMT is enabled.

4. Why isn’t the core scheduling feature enabled by default?

5. Core scheduling is managed using a new PR_SCHED_CORE option that was added to an existing system call, prctl(). That system call (which stands for “process control”) already supports a number of other ways to control processes. One example: You can use it to turn on and off performance counters, a Linux feature that collects performance statistics for a process. If you wanted to turn on performance counters for a process, what would you pass as the first parameter (the “option” parameter) to prctl()? (The answer can be found in the manual page.)

Article B: Apple’s current filesystem

The following documentation page describes a few distinguishing features of the filesystem, “Apple File System” (APFS), that Apple introduced for iOS and macOS in 2017:

That article mentions a “clone” feature, which involves sharing data between blocks in certain circumstances. For the questions below, assume that the size of blocks is 4 kilobytes (4kb).

1. Let’s say that we have an 12kb file named test.txt. If we run the command cp test.txt test2.txt on a regular filesystem that does not have the clone feature (like the class Linux server), how much total disk space will be used by the two files?

2. The cp command on macOS has been updated to use the APFS clone feature. If we run the same command, cp test.txt test2.txt, on macOS, how much total disk space will be used by the two files?

3. If we edit test2.txt on Linux, and change the first character of the file, will this change how much total disk space is used? If yes, give the new number.

4. If we edit test2.txt on macOS, and change the first character of the file, will this change how much total disk space is used? If yes, give the new number.

5. Again assuming 4kb blocks, consider the following sequence of operations using macOS’s FileHandle class, which supports APFS’s “sparse files” feature. Write 4kb of random data to a file, then use seek() to skip ahead 8kb, then write another 4kb of random data. How much disk space will this file use?

6. How much disk space would this file have used on a file system that didn’t have the sparse files feature?

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Exit mobile version