what is the use of threading we can do it by simply by calling the function so why we need thread function .can you tell me the right answer plz.
2-In semaphore we are using a unsigned integer which is kernel provide so that we can do synchronization so why we are not using a simple integer variable to perform synchronization.
Thanx
Threading is used when you can/need to run difference pieces of code concurrently.
Unsigned Int because that way you can guarantee the number isn't negative. Although I don't use semaphores personally, I prefer to use a Mutex for locking code and Barriers for Sync.