Write a c program that accepts two command line parameters

Assignment Help C/C++ Programming
Reference no: EM131734658

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 <YourName> <L3SID>

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_<YourName>_<L3SID>.c

Reference no: EM131734658

Questions Cloud

What is the maintain margin percent : Unfortunately, the movie wasn't as popular as hoped and the discount store needed to take markdowns of 50% to sell the dolls.
Define project relating to the goals of applied anthropology : How do you see your choice of project relating to the goals of applied anthropology
What is the final monthly payment level : Consider a $2 million, 8%, 30-year GPM with monthly payments and two annual step-ups of 10% each.
Creating venture success through entrepreneurship : Case Study Title: "Creating Venture Success through Entrepreneurship: The case of Latin American immigrant business owners in New York City"
Write a c program that accepts two command line parameters : 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.
Discuss a cultural behavior or tradition that was acceptable : A cultural behavior or tradition that was acceptable 50 years ago in our culture, but is now considered deviant today
What can be said of the net present value of first project : If both projects have the same total expected cash outflows, what can be said of the net present value of the first project compared with that of second project
What are the initial monthly payments on the loan : Consider a $2 million, 30-year amortization ARM with monthly payments and annual interest adjustments. The initial interest rate is 6%.
Hierarchical modeling can best be described : Hierarchical modeling can best be described as:

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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