-
Notifications
You must be signed in to change notification settings - Fork 9
add cs350 spring 2014 midterm #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
777lefty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some format issues and missing issues, and the problem-subproblem structure seems not to be consistent
|
|
||
| --- | ||
|
|
||
| ## Question 1a [2 point(s)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Background information for all subproblems in problem 1 is missed
|
|
||
| ## Question 1b [2 point(s)] | ||
|
|
||
| b. (2 marks)Show the output that will be produced when this program runs. Note that the statement printf(\"%d\",i); will print the value of integer variable i. You should show the combined output of all processes. Your answer should be a single sequence of numbers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code block here better
|
|
||
| --- | ||
|
|
||
| ## Question 2a [5 point(s)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
background information for all subproblems in problem 2 is missed
| ## Question 2a [5 point(s)] | ||
|
|
||
| a. (5 marks)In the space below, implement the lock tryacquire function, which has the following prototype: | ||
| int locktryacquire(struct lock *lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code block here better
| ## Question 2b [5 point(s)] | ||
|
|
||
| b. (5 marks)Suppose that a set of threads is using multiple locks for synchronization. In most cases, threads will acquire and release one lock at a time, using lockacquire and lockrelease. However, in some situations it is necessary for a thread to acquire two locks simultaneously. Write a function called acquiretwolocks that a thread can call to lock two different locks. The function prototype should be as follows: | ||
| void acquiretwolocks(struct lock *L1, struct lock *L2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code block here better
| // set the value in R1 to 1 to indicate success. Otherwise, | ||
| // do not change the value of the lock variable and set the value | ||
| // of R1 to 0 to indicate failure. | ||
| sc R1,&lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code block here better
| Crunchers never block. When they are chosen to run by the scheduler, they will run until they are preempted. Talkers, on the other hand, continuously output characters, as illustrated by the following pseudo-code: | ||
| while (true){ | ||
| /* output a character */ | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code block here better
|
|
||
| Do not use any synchronization primitives other than semaphores in your solution. Do not make any changes to the skeleton code other than inserting calls to semaphore operations. | ||
|
|
||
| (Skeleton implementations and declarations are provided to students; do not provide solutions in the exam text here.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's neither included here nor provided anywhere else?
|
|
||
| Do not use any synchronization primitives other than semaphores in your solution. Do not make any changes to the skeleton code other than inserting calls to semaphore operations. | ||
|
|
||
| (Skeleton implementations and declarations are provided to students; do not provide solutions in the exam text here.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's neither included here nor provided anywhere else?
|
|
||
| ## Question 7a [3 point(s)] | ||
|
|
||
| a. (3 total marks)Which of the following effects does a MIPS syscall instruction have when it is executed? (Note: we are interested only in the effects of this single instruction, not the effects of any code that runs after this instruction.) Circle all that apply. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can ask agent to output the items that apply rather than circle them here
Description
Add CS350 Spring 2014 Midterm exam data and solution file to the courseexam benchmark.
Changes
Testing
Prepared the dataset by running: python3 courseexam/prepare.py
Checklist