Can two threads in the same process synchronize using a kernel semaphore if the threads are implemented by the kernel? what if they are implemented in user space? assume that no threads in any other processes have access to the semaphore. discuss your answers.
Answer and Explanation:
It can be executed.
Locks and semaphores are comparative, then again, actually with semaphores, beyond what one string can be doing a given activity on the double.
Semaphores are regularly utilized when ensuring different undefined source. For instance, you may utilize a semaphore to keep a line from flooding its limits.
Using kernel threads, a string can hinder on a semaphore and the piece can run some other threads in a similar procedure.
Therefore, there is no issue utilizing semaphores. With client level threads, when one thread obstructs on a semaphore, the part thinks the whole procedure is blocked and doesn't run it until kingdom come. Therefore, the procedure comes up short.
With kernel threads, a thread can block on a semaphore and the kernel can run some other thread in the same process. Consequently, there is no problem using semaphores. With user-level threads, when one thread blocks on a semaphore, the kernel thinks the entire process is blocked and does not run it ever again. Consequently, the process fails.
OS X uses traditional counting semaphores rather than binary semaphores (which are essentially locks). Mach semaphores obey Mesa semantics
a variable of array type holds a reference of object
array are commonly used in computer program to organize data so that a related set of values
array are using zero base indexing it start with 0.
all component of array have same type, two different types doesn't use in single array
if array are store 10 quantities its index value varies from 0 to 9.
it stores 1st quantity value in index value 0 and this process will same till index value 9.
answer: internal fragmentation is the difference between the (fixed) size of a memory hole and the data within in that memory. for example, if a 1,024 byte block of memory holds 800 bytes of data, then the 224 bytes difference is considered lost to internal fragmentation.
external fragmentation occurs when the sum of memory fragments is large enough to satisfy a request, but the holes are non-contiguous and the request cannot be satisfied. this can occur when memory is dynamically allocated and freed.