Laboratory work №6
Course: Advanced Operating Systems
Software Engineering
Group: SE-2434
Student: Amish Madiyar
Instructor:
Kurakbayev Aibolat
Astana 2026
1. Introduction to Multiprocessor Architectures
UMA : In this system, all processors share a single memory. The access time to
any memory location is the same for every processor.
NUMA : In this system, memory is physically distributed. A processor can
access its own local memory faster than it can access memory located at other
processors.
2. Cache Coherence Simulation
I created a script in Python. I implemented a SharedMemory class to act as the
main storage and a Processor class for the individual workers. The code shows
that when one processor writes a value, the shared memory is updated so other
processors see the correct data.
3. Synchronization Mechanisms
We need mutexes to prevent race conditions. When many threads try to change
the same data at the same time, it causes errors. A mutex acts like a lock, so
only one thread can change the data at once, keeping the results accurate.
4. Implementing Mutexes
I wrote a script called mutex_example.py. I used threading.Lock() to protect a
counter variable. Five different threads try to increment the counter. Because of
the mutex, the threads don't interfere with each other, and the final value is
exactly 15, which is the correct result.
Report
In this lab, I learned how multiprocessor systems manage shared memory. I
practiced simulating a cache coherence protocol to keep data consistent across
different processors. I also learned how to use mutexes in Python to stop race
conditions. These skills are very important for building stable systems that use
many processors at the same time.