Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-05-2004, 01:23 PM   #1 (permalink)
kickerman97
Registered User
 
Join Date: Oct 2004
Posts: 9
kickerman97 is on a distinguished road
Question Any Ideas

What's the best way to attack this? Can someone show me how this would work? Thanks

Suppose a system has 4 types of resources and 5 processes. Write a java program lab4.java to test whether the system is in a safe state. Lab4.java should define a system class and a main method. The system class contains the system snapshot, namely matrixes Allocated and Max, and vector Available. The system class also contains four methods: setAllocated(), setMax(), setAvailable(), safe().

Besides returning a Boolean value, the safe() function should print the result to indicate the system status: either "The system is not safe!" or "The system is safe, since the process sequence < P2, P3, P0, P1, P4 > satisfies the safety criteria." (The sequence is the one that makes Finish[i] true for every i from 0 to 4 in the safe() function.)

Write main() program to test whether the following system is safe:
____Allocation________Max________Available________ ___Need
____A B C D________ A B C D_______A B C D__________A B C D
_________________________________3 5 2 0
       
P0___3 0 0 2_________3 0 1 2          
P1___1 0 0 0_________1 5 5 0        
P2___1 3 5 4_________2 3 5 6        
P3___0 6 3 2_________0 6 5 2        
P4___0 0 1 4_________0 6 5 6        

The main() program should contain the matrix assignment operations using the setAllocated(), setMax(), setAvailable() methods defined in the system class. Do not ask the user to input the values.
kickerman97 is offline   Reply With Quote
Old 12-05-2004, 04:42 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,230
Belisarius is on a distinguished road
This is more of a subject for Program Design and methods, as it doesn't look like there's anything particular to Java going on, and I'm stumped as to what the program is actually supposed to do.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 12-06-2004, 06:36 AM   #3 (permalink)
kaeli69
Registered User
 
kaeli69's Avatar
 
Join Date: Apr 2003
Posts: 30
kaeli69 is an unknown quantity at this point
When's the assignment due?
kaeli69 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program ideas? Vladk1000 Standard C, C++ 9 06-09-2004 11:03 PM
Relative paths -- I need help and I'm out of ideas. Mr.Anderson PHP 2 09-22-2003 08:46 AM
new poll? revolution Lounge 9 07-06-2003 05:12 AM
Poll Ideas Ilya020 Feedback 2 03-17-2003 08:14 AM


All times are GMT -8. The time now is 04:37 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting