C Program to lock file using semaphores.

Write a C Program to lock file using semaphores.Using semaphores, We can control access to files, shared memory and other things. The basic functionality of a semaphore is that you can either set it, check it, or wait until it clears then set it (“test-n-set”). In C semaphores functions defined in the sys/sem library. Read …

C program to Encrypt and Decrypt a password

C Strings:Write a C program to Encryption and Decryption of password.In this program we encrypt the given string by subtracting the hex value from it. Password encryption is required for the security reason, You can use so many functions like hash or other keys to encrypt. Read more about C Programming Language . and read …

C Program to solve the producer consumer problem

C Program to Solve the Producer-Consumer Problem Using Semaphores The producer-consumer problem (also called the bounded-buffer problem) is a classic process synchronization problem. A producer process generates data items while a consumer process reads them; a semaphore enforces the ordering so the consumer never reads ahead of the producer. Note: This program uses POSIX System …

C program to implement Round Robin CPU scheduling algorithm.

Write a C program to implement Round Robin CPU scheduling algorithm.In Round Robin scheduling algorithm, a small time slice or quantum is defined, all the tasks are kept in queue. The CPU scheduler picks the first task from the queue ,sets a timer to interrupt after one quantum, and dispatches the process. If the process …

C Program to demonstrate modf function.

Write a C program to demonstrate modf function.modf() defined in the C math.h library.modf function breaks the double/float values to integral part and fractional part. Example: res = modf(3.142, &iptr) returns res=142 and iptr=3. Read more about C Programming Language . and read the C Programming Language (2nd Edition). by K and R. /************************************************************ You can …

Anagram Program in C – Check if Two Strings are Anagrams

An anagram is a word or phrase formed by rearranging all the characters of another. In C, the standard way to check if two strings are anagrams is to count character frequencies: if both strings have exactly the same character counts, they are anagrams — regardless of order. This page shows a complete anagram program …