Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 12, Problem 12.22HW
Program Plan Intro
I/O Multiplexing:
- The idea of I/O multiplexing is to use “select” function to ask kernel to suspend process.
- It returns control to application only after one or more I/O events had occurred.
- It denotes waiting for a set of descriptors that is ready for reading.
- The “select” function would manipulate sets of type “fd_set”, that denotes descriptor sets.
- It takes two inputs: a descriptor set called “read set” and cardinality of read set.
- It blocks until at least one descriptor in read set is ready for reading.
- A descriptor “k” is ready for reading if and only if a request to read 1 byte from that descriptor would not block.
- The “fd_set” is been modified that points to argument “fdset” to indicate subset of read set called “ready set”.
- The value returned by function indicates cardinality of ready set.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Problem: Implement a part of functionality for the Netflix DVD queue. It's a service that allows a user to create a list of desired movies and then sends DVDs with movies on top (what we called head in our lectures) of this list to the subscriber one at a time. A subscriber should be able to create a list of desired movies and manipulate the order in a movie queue in their account. Your program will implement some of the desired functionality by storing the list of movie titles in a linked list. You are provided with the following files available in the "Downloadable files" section:
MovieList.h contains a class declaration for the class that represents a list of movies. top refers to the head position of a list and bottom refers to the tail or end position of a list.
Driver.cpp contains the main function you can use to test your implementation.
*** NOTE: Please do not change any of the function names since our automated test script calls those functions. Changing function names or…
Problem Y:
Implement the reader writer problem using pthreads and semaphores. You
should allow multiple readers to read at the same time and only one single
writer to write to the data set. You are required to use the following:
1. A semaphore rw_muter initialized to 1.
2. A semaphore muter initialized to 1.
3. An integer reader_count initialized to 0.
Create a postfix-to-infix translator with layers. The application should receive a postfix expression and output the corresponding infix expression until the user leaves. Throw an exception if the postfix phrase provided is illegal.
Chapter 12 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 12.1 - Prob. 12.1PPCh. 12.1 - Prob. 12.2PPCh. 12.2 - Practice Problem 12.3 (solution page 1036) In...Ch. 12.2 - Practice Problem 12.4 (solution page 1036) In the...Ch. 12.4 - Prob. 12.5PPCh. 12.4 - Prob. 12.6PPCh. 12.5 - Prob. 12.7PPCh. 12.5 - Prob. 12.8PPCh. 12.5 - Prob. 12.9PPCh. 12.5 - Prob. 12.10PP
Ch. 12.6 - Prob. 12.11PPCh. 12.7 - Prob. 12.12PPCh. 12.7 - Prob. 12.13PPCh. 12.7 - Prob. 12.14PPCh. 12.7 - Prob. 12.15PPCh. 12 - Prob. 12.20HWCh. 12 - Derive a solution to the second readers-writers...Ch. 12 - Prob. 12.22HWCh. 12 - Prob. 12.23HWCh. 12 - Prob. 12.24HWCh. 12 - Prob. 12.25HWCh. 12 - Prob. 12.26HWCh. 12 - Some network programming texts suggest the...Ch. 12 - Prob. 12.28HWCh. 12 - Prob. 12.29HWCh. 12 - Prob. 12.30HWCh. 12 - Implement a version of the standard I/O fgets...Ch. 12 - Prob. 12.32HWCh. 12 - Prob. 12.33HWCh. 12 - Prob. 12.34HWCh. 12 - Prob. 12.35HWCh. 12 - Prob. 12.36HWCh. 12 - Prob. 12.37HWCh. 12 - Prob. 12.38HWCh. 12 - Prob. 12.39HW
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- please give implementation of unsigned int getL1SetID(u_int32_t address){///// IMPLEMENT THIS /////return 0;}unsigned int getL2SetID(u_int32_t address){///// IMPLEMENT THIS /////return 0;}unsigned int getL1Tag(u_int32_t address){///// IMPLEMENT THIS /////return 0;}unsigned int getL2Tag(u_int32_t address){///// IMPLEMENT THIS /////return 0;}arrow_forwardAppendix A. BTB entries with PC and Target PC. Please include only entries with content.Entry PC Target0 423000 425E407 42E01C 42E0288 423020 4230A811 42E02C 42B30C14 423038 425E40: : :: : :1018 422FE8 4230A8arrow_forwardHOW TO DO THIS path FUNCTION IN C PROGRAMMING HELP!!! Add a new built-in path command that allows users to show the currentpathname list, append one pathname, or remove one pathname. In your shellimplementation, you may keep a data structure to deal with the pathname list.If you do not use execle() or execve() that allows you to execute withyour own environment variables, you will need to add it to the “real” PATHenvironment variable for executables in the path to work correctly. The initialvalue of path within your shell shall be the pathname list contained in the PATHenvironment variable. Implement the path command as follows:• path (without arguments) displays the pathnames currently set. It shouldshow pathnames separated by colons. For example, "/bin:/user/bin".• path + ./bin appends the pathname to the path variable. You mayassume that only one pathname is added at a time.• path - ./bin removes the pathname to the path variable. You mayassume that only one pathname is removed at…arrow_forward
- The code is in C++arrow_forwardFor the scramble.c problem, write a program that: • Has a main () function and another function that has this prototype: void scramble str (char s[]); • The scramble_str() function scrambles the contents of the string in a random way so that the string has the same length as before, but the contents are all mixed around. It does this in-place, i.e., there is only one buffer that holds a string. You're free to scramble it any way you want to, but use rand () repeatedly so it gets really scrambled. • The main () function will read a string entered by the user into the buffer, call scramble_str(), and output the resulting string. This will be done in a loop forever, until the entered string is the string "bye". When the user says "bye", the program will exit with a polite message. Do note that reading a string using scanf (), which is the only tool I've introduced you to so far, will just read up to the first whitespace. So, multiple-word strings won't work! Let's use something that will…arrow_forwardProblem: Implement a part of functionality for the Netflix DVD queue. It's a service that allows a user to create a list of desired movies and then sends DVDs with movies on top of this list to the subscriber one at a a time. A subscriber should be able to create a list of desired movies and manipulate the order in a movie queue in their account. Your program will implement some of the desired functionality by storing the list of movie titles in a linked list. You are provided with the following files available in "Downloadable files" section: MovieList.h contains a class declaration for the class that represents a list of movies. Driver.cpp contains a main function you can use to test your implementation. You will be responsible for providing the MovieList.cpp file, including the implementation of the MovieList member functions (described below): MovieList and ~MovieList: creates an empty list, and deallocates all the nodes in the list, respectively. display(ostream& out) Print…arrow_forward
- Computer Science Below question is based on google cloud Function Assume you have a Cloud Function created and it is set for unauthenticated invocation. Further assume the trigger type is HTTP. You may use whichever language you prefer for Google Cloud. What is the code required to display the following message from the page, assuming that username and status are passed in as querystring variables? Your assigned username is: username Your status is: statusarrow_forwardProblem: A A class octopus has a dummy head which has four pointers – left, right, top and bottom. You have to build link list in these 4 directions depending on the input commands. There will be four types of commands - L, R, T and B. Their specifications are given below: Lx: insert x in the left link list Rx: insert x in the right link list T x: insert x in the top link list // Where x is an integer number. Bx: insert x in the bottom link list Input: Test case will start with a number n indicating the number of lines following it. Output: you have to give output that which link list (Left, Right, Top and Bottom) has maximum sum of values. See the sampl and output. Нead 17 3 13 Sample input Sample output Right Link List Has Maximum Sum 32 14 L 3 L 15 L 1 R 17 T 9 T 10 В 13 T 5 R 3 В 2 В З В 4 ∞31 N34 H H M H LR R BBBarrow_forwardWe have to write Code in C language with the help of Linked list That perform following tasks . Search and display the contents of file based on name, age and salary of employees. Sort the data in ascending order based on the name (alphabetical order), age or salaryof employees.Edit the records and write the updated records back on the file.The file is in text mode, the user should be able to save this file (with a different name) in the binary mode.arrow_forward
- Python decorators can be used in Django in order to avoid duplication of code in view functions. For instance, consider the following definition of a decorator that is then applied to a view function. This code has three bugs: 01: def fetch_author (view_func) : 02: 03: 04: 05: 06: 07: 08: def wrapper (request, *args, **kwargs) : return view_func 09: 10: @fetch_author 11: def books_new (request) : 12: 13: 14: 15: 16: 17: } books = Book.objects.filter (authors _in= [author], year_ _gte="2015") context = { try: author = Author.objects.get (id-request. GET ["author_id"]) view_func (request, author, *args, **kwargs) except Author. Does NotExist: return bad_request (request, Author.DoesNotExist) Line 02 Line 05 Line 08 return render (request, "books-recent.html", context) Line 11 Identify the three lines which contain the three bugs: Line 12 Line 17 "title" : "New books", "books" books,arrow_forwardyou are to design a printer queue that is responsible for handling the printing requests coming from different users. You have to take into consideration that users have different levels of priorities. Each user has an identification number and a password, in addition to printing priorities. One good idea is to design the queue using an array or pointers while preserving the first-in first-out concept of the queue. For every printing request received, the program should check the priorities of that request and whether it can be moved forward in the queue to be served by the printer prior to serving the other requests. Using the programming language of your choice (preferably C++), write the printer queue that would handle the user request. The program must allow for requests coming from different users or from one user. Note: I need a working C++ code for this problem, and i need priorities.arrow_forwardCan you fix the following parts of the code in the Multilevel queue scheduling? Parts: //FCFS Scheduling //RR Scheduling with Time Quantum = 2 //Priority Scheduling Output of the values of Gantt Chart The provided code is in below and the output of the whole code must be the same on the answer on the image below thank you and don't reject it :( Code: #include <iostream>#include <queue>#include <string>#include <vector> struct Process { int processId; int burstTime; int priority;}; void print_gantt_chart(const std::vector<std::pair<int, int>>& gantt_chart) { std::cout << "Gantt Chart:" << std::endl; std::cout << "----------------------------------------------------------------------------" << std::endl; std::cout << "| "; for (const auto& process : gantt_chart) { std::cout << "P" << process.first << " | "; } std::cout << std::endl; std::cout…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,