Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Assignment

REMINDER: Each homework (including programming question) is individual. "Every single byte must come from you." Cut&paste from others is not allowed.

[This assignment does not have programming question, except the optional extra credit question.]

1. Given resource type X with two instances, resource type Y with a single instance, and three threads. As illustrated in the resource allocation graph,

1293_Resource-allocation-graph.jpg

• Thread 0 owns resource type Y's instance and is waiting for resource type X.
• Thread 1 owns one instance of resource type X.
• Thread 2 owns the other instance of resource type X and is waiting for resource type Y.

a. Are Coffman conditions true in this state?
b. Is there any deadlock? Why or why not?

2. Both segment table and page table are used to translate from logical address to physical address. But the structures of these tables are different; Each entry in a segment table is {base, length} while each entry in a page table is
{frame#}. Why the differences? Can we record base in a page table? Why there is no length in a page table?

3. Consider the following page reference string: 7, 2, 3, 1, 2, 5, 3, 4, 6, 7, 7, 1, 0, 5, 4

Assuming demand paging with 3 frames, fill in the table to indicate pages in the frames, page fault if any, and total number of page faults, for the following page replacement algorithms.

a. LRU

Time

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Reference

7

2

3

1

2

5

3

4

6

7

7

1

0

5

4

Frame 0

7

7

7

 

 

 

 

 

 

 

 

 

 

 

 

Frame 1

X

2

2

 

 

 

 

 

 

 

 

 

 

 

 

Frame 2

X

X

3

 

 

 

 

 

 

 

 

 

 

 

 

Page fault? (Y/N)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Total page faults = _____

b. FIFO

Time

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Reference

7

2

3

1

2

5

3

4

6

7

7

1

0

5

4

Frame 0

7

7

7

 

 

 

 

 

 

 

 

 

 

 

 

Frame 1

X

2

2

 

 

 

 

 

 

 

 

 

 

 

 

Frame 2

X

X

3

 

 

 

 

 

 

 

 

 

 

 

 

Page fault? (Y/N)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Total page faults = __________

4. On a machine with 16 bytes page size, given the following page table for a process, and four of these 8 entries are mapped to page frames. Frame 0 starts at physical address 0. (All numbers given are in decimal.)

Page number

Frame number

0

3

1

0

2

Not in main memory

3

Not in main memory

4

2

5

Not in main memory

6

1

7

Not in main memory

a. Make a list of all virtual address ranges (in decimals, byte-level) that would cause page faults.
b. What are the corresponding physical addresses (in decimals, byte-level) of the following virtual addresses (in decimals, byte-level)

• 0
• 17
• 31
• 32
• 100

5. Assume that a system has a 32-bit virtual address with N-KB page size (where N >= 1, and 1KB = 1024 bytes). Write a C program that accepts two command line parameters, the first one being the value of N (in decimal notation) and the second one being a virtual address in decimal notation, and have it output the page size, the page number and offset for the given virtual address. For example,

./vaddr 4 19985
The program should output
Virtual address translation by

Page size = 4096, virtual address 19985 => page number = 4, offset = 3601 Replace YourName and L3SID with your own name, and last 3 digits of your SID. Test your program with the following four runs

./vaddr 1 19981
./vaddr 2 19982
./vaddr 4 19984
./vaddr 8 19988

and capture screenshots of your program execution. Submission:

• At the end of the regular report, include screenshots of those four runs. Note each screenshot must include "Virtual address translation by ...".

• Your source code, named as vaddr__.c

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92543344

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As