All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Tutor
New
Search
Search
Sign In
Register
study help
computer science
computer systems a programmers perspective
Questions and Answers of
Computer Systems A Programmers Perspective
As before, suppose the disk file foobar.txt consists of the six ASCII characters foobar. Then what is the output of the following program? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include "csapp.h" int
Implement a place function for the example allocator.static void place(void *bp, size_t asize)Your solution should place the requested block at the beginning of the free block, splitting only if the
Describe a reference pattern that results in severe external fragmentation in an allocator based on simple segregated storage.
Assuming that the disk file foobar.txt consists of the six ASCII characters foobar, what is the output of the following program? 1 #include "csapp.h" 2 3 4 5 6 7 8 9 10 11 12 13 14 15 int
How would you use dup2 to redirect standard input to descriptor 5?
Write a program hex2dd.c that converts its 16-bit hex argument to a 16-bit network byte order and prints the result. For example linux> ./hex2dd 0x400 1024
Write a program dd2hex.c that converts its 16-bit network byte order to a 16-bit hex number and prints the result. For example, linux> ./dd2hex 1024 0x400
Figure 12.5 demonstrates a concurrent server in which the parent process creates a child process to handle each new connection request. Trace the value of the reference counter for the associated
Assume that a CGI program needs to send dynamic content to the client. This is typically done by making the CGI program send its content to the standard output. Explain how this content is sent to
In Figure 12.43, we might be tempted to free the allocated memory block immediately after line 14 in the main thread, instead of freeing it in the peer thread. But this would be a bad idea.
In Linux systems, typing Ctrl+D indicates EOF on standard input. What happens if you type Ctrl+D to the program in Figure 12.6 while it is echoing each line of the client?Figure 12.6 1 #include
If we were to delete line 33 of Figure12.5, which closes the connected descriptor, the code would still be correct, in the sense that there would be no memory leak. Why?Figure12.5
Consider three processes with the following starting and ending times:For each pair of processes, indicate whether they run concurrently (Y) or not (N): Process A BC с Start time 1 2 4 End
List all of the possible output sequences for the following program: 1 int main() 2 { لا لها 3 4 5 6 7 8 9 10 11 12 } if (Fork() == 0) { printf("9"); fflush(stdout); } else { printf ("0");
Consider the following program:A. How many output lines does this program generate?B. What is one possible ordering of these output lines? 1 int main() 2
Function funct3 has the following prototype:double funct3(int *ap, double b, long c, float *dp);For this function, gcc generates the following code:
Determine the byte encoding of the Y86-64 instruction sequence that follows. The line .pos 0x100 indicates that the starting address of the object code should be 0x100. .pos 0x100 # Start code at
One common pattern in machine-level programs is to add a constant value to a register. With the Y86-64 instructions presented thus far, this requires first using an irmovq instruction to set a
For each byte sequence listed, determine the Y86-64 instruction sequence it encodes. If there is some invalid byte in the sequence, show the instruction sequence up to that point and indicate where
Write Y86-64 code to implement a recursive product function rproduct, based on the following C code:Use the same argument passing and register saving conventions as x86-64 code does. You might find
Modify the Y86-64 code for the sum function (Figure 4.6) to implement a function absSum that computes the sum of absolute values of an array. Use a conditional jump instruction within your inner
Modify the Y86-64 code for the sum function (Figure 4.6) to implement a function absSum that computes the sum of absolute values of an array. Use a conditional move instruction within your inner
Let us determine the behavior of the instruction pushq %rsp for an x86-64 processor. We could try reading the Intel documentation on this instruction, but a simpler approach is to conduct an
In the server in Figure 12.8, pool.nready is reinitialized with the value obtained from the call to select. Why?Figure 12.8 1 #include
In the process-based server in Figure 12.5, we observed that there is no memory leak and the code remains correct even when line 33 is deleted. In the threads based server in Figure 12.14, are there
A. Fill each entry in the following table with “Yes” or “No” for the example program in Figure 12.15. In the first column, the notation v.t denotes an instance of variable v residing on the
Complete the table for the following instruction ordering of badcnt.c: Step 123 4 5 6 890 Thread 10 112NN2 7 1 Step
Using the progress graph in Figure 12.21, classify the following trajectories as either safe or unsafe.Figure 12.21 A. H₁, L1, U₁, S1, H2, L2, U2, S2, T2, T1 B. H₂, L2, H₁, L1, U1₁, S1, T1,
Consider the following program, which attempts to use a pair of semaphores for mutual exclusion.A. Draw the progress graph for this program.B. Does it always deadlock?C. If so, what simple change to
A. In Figure 12.43, we eliminated the race by allocating a separate block for each integer ID. Outline a different approach that does not call the malloc or free functions.B. What are the advantages
The rand_r function in Figure 12.40 is implicitly reentrant. Explain.Figure 12.40 1 2 3 4 5 6 /* rand_r - return a pseudorandom integer on 0..32767 */ int rand_r(unsigned int *nextp) { } *nextp
Fill in the blanks for the parallel program in the following table. Assume strong scaling. Threads (t) Cores (p) Running time (Tp) Speedup (S₂) Efficiency (E₂) 1 1 16 1 100% 44 8 00 00 8 8 4
The solution to the first readers-writers problem in Figure 12.26 gives priority to readers, but this priority is weak in the sense that a writer leaving its critical section might restart a waiting
Let p denote the number of producers, c the number of consumers, and n the buffer size in units of items. For each of the following scenarios, indicate whether the mutex semaphore in sbuf_insert and
Showing 200 - 300
of 234
1
2
3