Sample Program for Declaration Reading

This a sample program to demonstrate the use of various declarations that are used. There are indeed many more that are used based on given situation, but these are references on how few of them are used. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~An Article by: Yashwanth Naidu Tikkisetty~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Read More Sample Program for Declaration Reading

Reading Declarations in C

When reading code, follow these points: 1) * – pointer to 2) [] – array of 3) () – function returning 4) Start at the variable name 5) Read right first without crossing parenthesis 6) Then go left without crossing 7) Start inwards and move outwards. Reading is right to left. Examples are provided for different variable types.

Read More Reading Declarations in C

 𝑭𝒆𝒘 𝑰𝑷𝑪 𝑴𝒆𝒄𝒉𝒂𝒏𝒊𝒔𝒎𝒔 𝒊𝒏 𝑳𝒊𝒏𝒖𝒙

Pipes, FIFOs, and message queues are inter-process communication mechanisms. Pipes enable unidirectional data flow between related processes, while FIFOs allow communication between unrelated processes. Message queues provide message boundaries and message type selection. Each mechanism offers unique functions for creating, sending, receiving, and controlling communication.

Read More  𝑭𝒆𝒘 𝑰𝑷𝑪 𝑴𝒆𝒄𝒉𝒂𝒏𝒊𝒔𝒎𝒔 𝒊𝒏 𝑳𝒊𝒏𝒖𝒙

𝐄𝐢𝐭𝐡𝐞𝐫 𝐎𝐫𝐩𝐡𝐚𝐧𝐞𝐝 𝐨𝐫 𝐙𝐨𝐦𝐛𝐢𝐞𝐝

When using the fork() function, it’s crucial to handle the process creation outcomes to avoid orphaned or zombie processes. Orphaned processes result when the parent completes before the child, and zombies occur when the child finishes first. This creates resource management challenges and may require system shutdown to address. Proper handling prevents these issues.

Read More 𝐄𝐢𝐭𝐡𝐞𝐫 𝐎𝐫𝐩𝐡𝐚𝐧𝐞𝐝 𝐨𝐫 𝐙𝐨𝐦𝐛𝐢𝐞𝐝

 𝐀 𝐒𝐡𝐨𝐫𝐭 𝐰𝐫𝐢𝐭𝐞 𝐮𝐩 𝐨𝐧 𝐩𝐭𝐡𝐫𝐞𝐚𝐝 𝐟𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬

The pthread library is vital for multithreaded programming in Linux. It provides functions for thread creation, deletion, and management, such as pthread_create, pthread_exit, pthread_self, pthread_join, pthread_detach, pthread_mutex_init, and more. These functions enable efficient utilization of system resources and enhanced program performance.

Read More  𝐀 𝐒𝐡𝐨𝐫𝐭 𝐰𝐫𝐢𝐭𝐞 𝐮𝐩 𝐨𝐧 𝐩𝐭𝐡𝐫𝐞𝐚𝐝 𝐟𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬

FORK IT!

The fork() system call allows a parent process to create a child process with an identical memory layout. The parent receives the child’s process ID, while the child receives 0. Synchronization techniques are needed for desired forking. Multiple calls to fork() create a complex process tree, managed efficiently through copy-on-write to optimize memory usage.

Read More FORK IT!

𝐄𝐱𝐩𝐥𝐨𝐫𝐢𝐧𝐠 𝐭𝐡𝐞 𝐒𝐲𝐬𝐭𝐞𝐦 𝐜𝐚𝐥𝐥𝐬

To transition from user space to kernel space, system calls are essential for executing actions on the kernel’s behalf. One example is the use of dynamic memory allocators like malloc() and realloc(), which rely on system calls such as sbrk() and brk(). Additionally, system calls like system(), clone(), wait(), and rt_sigaction() play key roles in process management.

Read More 𝐄𝐱𝐩𝐥𝐨𝐫𝐢𝐧𝐠 𝐭𝐡𝐞 𝐒𝐲𝐬𝐭𝐞𝐦 𝐜𝐚𝐥𝐥𝐬