عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 01-11-2009, 08:49 PM   #11

Mr.Ahmad

عضو هيئة تدريس

الصورة الرمزية Mr.Ahmad

 
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , واجبات , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة فييري وسيدورف مشاهدة المشاركة
شباب ياريت السلايداتن الجديدة حق الحوسبة ( الي في اول سلايد خلفية الكتاب)

لاني سمعت انهم غيروووها

وابي اسال اللي يعرف متو مواعيد الاختبارات حق الحوسبة والبرمجة وهل هي موحدة ولاكيف؟

ويديكم العافية وخصوصا الاخ احمد
http://www.skaau.com/vb/showthread.php?t=113063

المشاركة الأصلية كتبت بواسطة loOoly_k مشاهدة المشاركة
السلاااام عليكم ،

انا محتاجه ضرووري ياليت تقدر تبرمج لي هذا الشيت



Write a program to implement the banker's algorithm in C++ version.5 code.

Do the following:

 Declare these variables as global constants:

 N  number of processes
 M  number of resources' types

 Declare these variables as global variables:

 Inst 1-dimension array (M) contains the number of instances of each recourse type
 Alloc  2-dimension array (N*M) contains the allocated recourses for each process
 Max  2-dimension array (N*M) contains the maximum need for each process
 Pè the process number that send a request (Req) (0,1,2,…..,n)
 Req è 1-dimension array (M) contains the requested recourses of process P


 You must use these variables' names:
 Need  2-dimension array (N*M) contains the actual need for each process
 Avl è 1-dimension array (M) contains the available recourses (i.e. not allocated)
 Workè1-dimension array (M) contains the available recourses (used in safety algorithm)
 Fnshè1-dimension array (N) contains flags to indicate if a process finished or not (used in safety algorithm)

Program Input:
No input from user. All needed values will be declared as global variables and initialized inside the program.

Const int n =5; //number of processes
Const int m= 3; //number of recourses' types

// values of resources' instances
Int inst[m]= {10,5,7};

// values of allocation array
Int alloc[n][m]= { {0,1,0},
{2,0,0},
{3,0,2},
{2,1,1},
{0,0,2}};

// values of max array
Int max[n][m]= { {7,5,3},
{3,2,2},
{9,0,2},
{2,2,2 },
{4,3,3}};

Int p=1; // the requested process' No.
int req[m] ={1,0,2}; //the request

Program output:
The output will be a display of the contents of Avl ,Need,Alloc, work, fnsh and a suitable message of the following:
 Invalid requestè (if Req ≤ Need)
 Process (i) will wait because recourses are not availableè (if Req ≤ Avl)
 Process (i) will wait because new state is not safe.
 Process (i) will executed immediately & display the appropriate process's sequences.
Where : ( i) is the process number.

Delivery procedure:
 Deadline: Sunday 13/11/1430 H – 1/11/2009 @ 12:05 PM
 You must deliver :
 A print of source code.
 A soft copy (on a CD)of source code (.cpp) and all files produced after compiling & linking
 CD must be clean (free of viruses and threats)
 The code must be able to run ( No errors in syntax or linking…etc), any code with errors will be evaluated by zero!!!
 Use Only CD's and an enclosed plastic file
 Write your name + your group (A/B/C) on each page on the hardcopy , on CD, on the plastic file and in side the code (in the header) .
 Loose paper is not allowed use pins or paper's clip.
 In side the code , you must use clear & summarized comments.

Output format:
Important note: the values bellow aren't true

The arrays contents:

PROCESS ALLOCATED NEED Finish
======== =========== ===== ======
R0 R1 R3 R0 R1 R3
P0 0 1 0 7 4 3 T
P1 3 1 0 6 4 3 T
P2 0 1 4 7 0 3 F
P3 2 1 0 1 4 3 T
P4 1 1 0 3 4 3 F
================================================== =====
Resource Available work
======== =========== =====
R0 3 10
R1 3 5
R2 2 7
================================================== =====
Process (1) will executed immediately
Process's sequences: P1, P2, P0, P4, P3


بكره الساعه 12 التسليم :(
ما شاء الله ,,, قد لا يممكني حله بالوقت المطلوب ,, على حسب أنتهاء واجباتي .
بالتوفيق .

 

توقيع Mr.Ahmad  

 

سبحان الله وبحمد ,,, سبحان الله العظيم
الحمد لله كما ينبغي لجلال وجهه وعظيم سلطانه .
اللهم صل على محمد وعلى آل محمد كما صليت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد . اللهم بارك على محمد وعلى آل محمد كما باركت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد.

 

Mr.Ahmad غير متواجد حالياً   رد مع اقتباس