programming practice exercises

int ReverseString(char *); main() { char *Str; printf(“enter any stringn”); gets(Str); ReverseString(Str); getch(); } int ReverseString(char *rev) { if(*rev!=’’) { ReverseString(rev + 1); putchar(*rev); } return 1; }   non recursion void ReverseString( char* str, int len ) { while( len > 1 ) { swap( &str[0], &str[len – 1] ); ++str; len -= 2; […]

Read More

3 Producers and 2 Consumers Problem using PThread in C Language on Linux System

2. prodConM This is a  second version of the program. In this version, there are 3 producers and 2 consumers. The producers have to compete with each other, as well as with consumers. When two or more producers are waiting to dump their produce into the buffer, the products must be inserted into the main […]

Read More

One consumer and one producer problem using PThreads in C Programming Language.

1. ProdCon This is a program about the producer and consumer problem. Where a producer will produce and a  consumer will consume but the two of them can not access the buffer content at the same time. This is concurrence programming using threads in c language. The producer and consumer threads are given randomly generated […]

Read More

Questions and answers to some problems in principles of operating systems textbook

Operating System Concept,” 8th edition, Silberschatz, Galvin, Gagne: Wiley, 2008.  1. Textbook page 352, problem 8.11 (memory holes)   Available partitions (holes): 100, 500, 200, 300, 600 (underlined numbers represent the partition being used to fit the request) First-fit algorithm   212                  100, 288, 200, 300, 600 417                  100, 288, 200, 300, 183 112                  100, […]

Read More