↳
Two processes each holding a resource tries to access the other's resource.
↳
Or you could forget to unlock.
↳
There are 4 conditions from Coffman's: A deadlock situation can arise if all of the following conditions hold simultaneously in a system:[1] 1. Mutual Exclusion: At least two resource must be non-shareable.[1] Only one process can use the resource at any given instant of time. 2. Hold and Wait or Resource Holding: A process is currently holding at least one resource and requesting additional resources which are being held by other processes. 3. No Preemption: The operating system must not de-allocate resources once they have been allocated; they must be released by the holding process voluntarily. 4. Circular Wait: A process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release the resource. In general, there is a set of waiting processes, P = {P1, P2, ..., PN}, such that P1 is waiting for a resource held by P2, P2 is waiting for a resource held by P3 and so on until PN is waiting for a resource held by P1.[1][7] Less
↳
printf is a blocking routine. It **must** not be used in an ISR. Consider the case then an interrupt arrived and this ISR is invoked and stdout is blocked by some other task. This code will give you nightmare bugs which are almost impossible to debug Less
↳
How will you declare the following: (a) A pointer to an integer: (b) A pointer to a pointer to an integer: (c) An array of ten integers: (d) An array of ten pointers to integers: (e) A pointer to an array of ten integers (f) A pointer to a function that takes an integer as an argument and returns an integer Less
↳
Basically, what I told was, since you know where to start and the length of the memory to be mapped, you basically need to know on which page it starts (0,1,2) and which page the mapping ends(depending on the length) and then when you know that you can return those pages. I could answer only through a pseudo code, where I used the idea of using the page size as the divisor and use the addresses to find the on which page they lied. The interviewer didn't approve of that (as they were pseudo codes) and that the division operations were not efficient (Agreed). I asked him what the correct answer was, he wrote something hurriedly, related to bit-shifting (which is division done efficiently). If somebody knows the standard question and answer please post it. Less
↳
When a page size is fixed (usually a power of 2) you can take that many bits out of the lower order bits in the memory to be mapped to figure out what the offset within a page is. And the remaining bits would tell you the page number. Less
↳
basically that I had the ability to learn, but had not made practice of raw coding in notepad, but had used a WYSWYG editor in the past (school) Less
↳
Um. Where is the door?