https://www.google.com/search?sca_esv=225f5ed1c09bb846&rlz=1C1GCEA_enCA1060CA1060&q=what+is+semaphore&tbm=vid&source=lnms&sa=X&ved=2ahUKEwjnm6bC1bCEAxXaJDQIHSGUATMQ0pQJegQIYBAB&biw=1920&bih=919&dpr=1#fpstate=ive&vld=cid:0eb70dd5,vid:ukM_zzrIeXs,st:0
semaphore
contains 0/1, is mainly for threads to use,
wait() decrement value from semaphore, if value is 0 wait
post() increase sempahore value by 1,
semphamore value can never be negative, used to lock resource for threading
https://medium.com/geekculture/processes-threads-deadlock-semaphores-and-more-f70be5395ef6
No comments:
Post a Comment