0% found this document useful (0 votes)
15 views

Operating System Unit 3 - University of The People

The document discusses three topics: 1) Navigating file systems involves accessing and manipulating files and directories using functions like scandir() in PHP. 2) Memory management involves allocating and releasing memory resources using keywords like new and delete in C++. 3) Messaging between processes allows passing information between processes using inter-process communication mechanisms like queues in Python.

Uploaded by

Bui Dieu Huong
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Operating System Unit 3 - University of The People

The document discusses three topics: 1) Navigating file systems involves accessing and manipulating files and directories using functions like scandir() in PHP. 2) Memory management involves allocating and releasing memory resources using keywords like new and delete in C++. 3) Messaging between processes allows passing information between processes using inter-process communication mechanisms like queues in Python.

Uploaded by

Bui Dieu Huong
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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