Download presentation
Presentation is loading. Please wait.
1
O.S. Programming Assignment
O.S. Programming Assignment Dining Philosopher Wrriten by Hoon-Seung Jeong
2
Index 1 2 3 4 5 Work Environment System Description Test Description
Index Work Environment 1 System Description 2 Test Description 3 User Documentation 4 Self-evaluation 5
3
Work Environment Windows XP Visual Studio 2005 .NET AMD Turion
Work Environment Windows XP 2.0GB RAM AMD Turion 1.60GHz Dual Visual Studio 2005 .NET
4
System Description WWW.JHS.PE.KR
typedef struct Man // Sitdown Man Information Struct { int id; Dining_Philosopher *dp; HANDLE left,right; } Man; void main() // 5 is Max Size struct Man DP[5]; HANDLE ghMutex[5]; HANDLE aThread[5]; DWORD ThreadID; int i,j,temp; bool random_check; // If Event Random is coming, Same Number is interception for(i=0;i<5;i++) { } // Create a mutex with no initial owner srand( (unsigned int)time(NULL) ); // Setting each Man Number, Setting Left, Right for(i=0;i<5;i++) { } for( i=0; i < 5; i++ ) { } // Create worker threads WaitForMultipleObjects(5, aThread, TRUE, INFINITE); // Wait for all threads to terminate for( i=0; i < 5; i++ ) CloseHandle(aThread[i]); // Close thread and mutex handles for( i=0; i < 5; i++ ) CloseHandle(ghMutex[i]); }
5
Test Description
6
User Documentation Mutex Object CreateThread Function srand Function
User Documentation Mutex Object A mutex object is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned. Only one thread at a time can own a mutex object, whose name comes from the fact that it is useful in coordinating mutually exclusive access to a shared resource. CreateThread Function Creates a thread to execute within the virtual address space of the calling process. To create a thread that runs in the virtual address space of another process. srand Function The srand function sets the starting point for generating a series of pseudorandom integers in the current thread.
7
50 Self-evaluation Because WWW.JHS.PE.KR
Reference that the most important source in senior.
8
Thank You ! Do you have questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.