Operating System Unit 3 - University of The People

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Navigating the file system: Navigating the file system involves accessing and

manipulating files and directories on a computer's storage device. This can be done
using various file system functions or libraries in programming languages such as
PHP. (Gomakethings, Aug 2022).
Example: In PHP, the scandir() function can be used to retrieve a list of files and
directories in a specified directory.
$dir = "/path/to/directory";
$files = scandir($dir);
foreach ($files as $file) {
echo $file . "<br>";
}
Handling memory: Memory management involves allocating and releasing memory
resources in a computer's RAM. This is an important concept to understand when
developing applications, as poorly managed memory can lead to performance issues
and crashes. (Simplilearn, Feb 2023).
Example: In C++, memory can be allocated dynamically using the new keyword, and
released using the delete keyword.
int* ptr = new int;
*ptr = 10;
delete ptr;

Messaging between processes: Messaging between processes involves passing


information between different processes or threads in an operating system. This can be
done using various inter-process communication (IPC) mechanisms such as sockets,
pipes, and message queues. (Pymotw, n.d.).
Example: In Python, the multiprocessing module can be used to create and manage
processes, and the Queue class can be used to pass messages between them.
from multiprocessing import Process, Queue
def worker(q):
while True:
item = q.get()
print(item)
if __name__ == '__main__':
q = Queue()
p = Process(target=worker, args=(q,))
p.start()
q.put('message 1')
q.put('message 2')
p.join()
Deferrences
Gomakethings. (Aug 2022). Navigating the file system with Terminal.
Gomakethings. https://gomakethings.com/navigating-the-file-system-with-terminal/
Pymotw. (n.d.). Communication Between Processes. Pymotw.
https://pymotw.com/2/multiprocessing/communication.html
Simplilearn. (Feb 2023). All You Need to Know About C++ Memory Management.
Simplilearn. https://www.simplilearn.com/tutorials/cpp-tutorial/cpp-memory-
management

You might also like