Problem 4: drptr (a pointer to the allocated memory) and dsptr (a pointer to a g
ID: 3739851 • Letter: P
Question
Problem 4: drptr (a pointer to the allocated memory) and dsptr (a pointer to a global data structure) are passed as parameters to dskenq function. Read the code segment carefully to answer the following questions. 1 Problem 2 Code Segment 2 dskeng(drptr, dsptr) struct dreq *drptr; struct dsblk *dsptr: struct dreq p, q DBADDR block; int st 18 ? dsptr->dreqlst drptr drptr->drnext- DRNULL; dskstrt(dsptr); return (DONQ); 12 13 14 15 ? 16 17? 18 19 20 21 v block drpt r--d rdba ; if (p->drdba--block && (st-dskqopt(p, q, drptr)!-SYSERR)) return(st); if ((q->drdba block && block drdba) II (q-»drdbablock && block > p->drdba drptr->drnextp; q--drnext = drptr; return(DONQ) 23 24 25 A 26 A 27 28 29 q->drnext- drptr return(DONQ) (2 points) Does the function dskstrt have access to the allocated memory? If yes, explain in one sentence how does it get the access A. B. (2 points) What could be functions that get access to the allocated memory as a result of the assignment in line 28? Explain your answer in one sentence.Explanation / Answer
Solution:
A)
Yes, the memory will be allocated to dskstrt because dspte has already been allocated the memory and it is passed as an argument to hte dskstart.
B)
dskopt will get the access in this case.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)