what is the advantage of using SEMAPHORES to ORDINARY
VARIABLES???
Answers were Sorted based on User's Feedback
Answer / sachin dohre
Working of Semaphore is Atomic i.e till semaphore released
no change in shared memory could occur,, while in case of
variables it could be changed while context switching
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / test
semaphores helps is a varible which is used to protect the shared data .hence avoiding the coruption of data by the threads acting simultaniously..
| Is This Answer Correct ? | 7 Yes | 4 No |
What is the use of define in c?
Why is it important to memset a variable, immediately after allocating memory to it ?
Explain what is the advantage of a random access file?
What is the heap?
can we print any string in c language without using semicolon(;)(terminator) in whole program.
what is the maximum limit of row and column of a matrix in c programming. in linux .
#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?
What is hashing in c language?
Explain the red-black trees?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Is c high or low level?
void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pint; for(i=0;i<=3;i++) { p=&s[i]; pint=p; printf("\n"); for(j=0;j<=1;j++) printf("%d",*(pint+j)); } } while running this program it shows a warning-suspicious pointer conversion ie pint=p; my que is why should we assign the value of p to pint again.why cant we use it directly as *(p+j)..but if i use like tat the o/p is garbage value..