Skip to content

KaanYT/National-Flag-Problem-with-semaphores-multi-thread-process

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

National-Flag-Problem-with-semaphores-multi-thread-process

National Flag Problem with semaphores multi-thread and multi-process

Implementation Based on Linux semaphores

How to run: gcc multi_thread.c -lpthread -o Thread

./Thread

Options: GET_DATA_FROM_CONSOLE You can dynamically enter Array size and range of numbers as console argument. ARRAY_SIZE/RANGE_SIZE If console argument is false defined values are gonna be used. TEST_ALL Test the result. PRINT_ARRAY Print array after completing the task.

Program: Create random array based on range size. Divide array to equal size for each thread. In first cycle find how many of each number and record them. Last thread combine all results. In second cycle put data to proper place.

Results: In 50M Array Multi Process: 106.9 ms Multi Thread: 84.5 ms

Test System:
	CPU: i7-2670QM @ 2.20
	RAM: 16GB

About

National Flag Problem with semaphores multi-thread and multi-process

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages