Concurrent Systems and Processes

I am working on a concurrency problem of a shop who can have no more than 5 people in the store at one time, the shopkeeper can only serve one customer at a time and during that time the customer has exclusive access to the shopkeeper, after the customer has got access to the shopkeeper the shopkeeper will wait until the customer indicates he is ready to make a purchase and will then wait until his items are bagged. I am told to assume that a customer that enters the shop will always purchase an item.
I would appreciate it if someone would look at my code and see if I am going about the problem in the correct way or not, thanks.
/* Note. You can assume that customers entering the shop will queue up in
/* an orderly fashion and begin to be served starting with the one currently
/* at the head of the queue.
Global Invariant: (num_cust_in_shop <= SHOP_CAPACITY)
process main_process
     /* declare and initialise global values/variables
     final int SHOP_CAPACITY = 5;
     int num_cust_in_shop = 0; //initially the shop is empty
     int NUM_CUSTOMERS = 20; // this is the number of potential customers
     boolean lock = false; // this lock ensures exclusive update of global variable
     //set processes running
     co for [j=1 to NUM_CUSTOMERS] customer_process[j] // shopkeeper_process oc
} //end main_process
//customer process
process customer_process [int I=1 to N]
     while(true){
     <await (num_cust_in_shop < SHOP_CAPACITY)>; //wait if shop is full
     {...one customer enters shop...};
     //exclusive update of global variable num_cust_in_shop
     <await (lock==false) lock=true;>
     num_cust_in_shop = num_cust_in_shop + 1;
     <lock = false>;
     }//end while
}//end customer_process
//shopkeeper process
process shopkeeper_process
     while(true){
     <await (num_cust_in_shop >=1)>
     {...serve customers in shop...};
     <await (lock==false)lock=true;>
          num_cust_in_shop:=num_cust_in_shop -1;
     <lock = false>;
     } //end while
} //end shopkeeper_processEdited by: JP_Training on Feb 8, 2010 2:41 PM

Your very best bet is to take this to your instructor and ask him. He knows what he wants. What ever you have there is not valid Java code.

Similar Messages

  • AIS (Audit Information Systems) and Process controls

    Dear Experts
    Have you seen any customer using AIS (Audit Information Systems) and Process controls, simultaneously for Audit purposes? Can we use the GRC Process Controls for Scheduling regular Audits, inaddition to the Internal Control Assessments?
    Thanks & Regards
    Swarna

    Hi Swarna,
    Have you seen any customer using AIS (Audit Information Systems) and Process controls, simultaneously for Audit purposes?
    Yes. AIS is purely in SAP users and authorizations,  and PC can be used at different levels.
    Can we use the GRC Process Controls for Scheduling regular Audits, inaddition to the Internal Control Assessments?
    The data from the PC is used in the ICAs. So PC itself can't/may not provide all the information that is required by the auditors.
    Regards,
    Raghu

  • Getting system and process information

    Hello frens..
    I need to know can we access system information in window using java
    Well i need to know
    1. how much memory a process is taking
    2. what is total CPU uitisation
    3. what is CPU uitisation of particular process
    4. and if some service is down (say database) is down than starting again that service.
    5. how to restart syatem
    I m using windows xp

    Thanks for response
    well JNI will cause to write all programm in C or c++ and then call them from java.
    is there not any java package where from we will get all those information
    if not then plz tell me where from i can hv c or c++ code for getting all system info

  • Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. I have a wndiws 7 system and use a Intel core processor. I have restarted several times and still ge this

    Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. I have a wndows 7 system and use a Intel core processor. I have restarted several times and still ge this error. I have also tried to reinstall firefox and get the same error
    == This happened ==
    Every time Firefox opened
    == today ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDS; InfoPath.2; .NET4.0C; AskTbUT2V5/5.8.0.12304)

    <u>'''Kill Application'''</u>
    In Task Manager, does firefox.exe show in the <u>'''Processes'''</u> tab?
    See: [http://kb.mozillazine.org/Kill_application Kill Application]
    '''<u>Causes and solutions for Firefox hanging at exit:</u>'''
    [[Firefox hangs]]
    [http://kb.mozillazine.org/Firefox_hangs#Hang_at_exit Firefox hangs at exit]
    [[Firefox is already running but is not responding]]
    <u>'''Safe Mode'''</u>
    You may need to use '''[[Safe Mode]]''' (click on "Safe Mode" and read) to localize the problem. Firefox Safe Mode is a diagnostic mode that disables Extensions and some other features of Firefox. If you are using a theme, switch to the DEFAULT theme: Tools > Add-ons > Themes <u>'''before'''</u> starting Safe Mode. When entering Safe Mode, do not check any items on the entry window, just click "Continue in Safe Mode". Test to see if the problem you are experiencing is corrected.
    See:
    '''[[Troubleshooting extensions and themes]]'''
    '''[[Troubleshooting plugins]]'''
    '''[[Basic Troubleshooting]]'''
    If the problem does not occur in Safe-mode then disable all of your Extensions and Plug-ins and then try to find which is causing it by enabling <u>'''one at a time'''</u> until the problem reappears. <u>'''You MUST close and restart Firefox after EACH change'''</u> via File > Restart Firefox (on Mac: Firefox > Quit). You can use "Disable all add-ons" on the Safe mode start window.

  • System status for IDOC creation and processing for production orders

    All
    I am creating IDOCs for production orders to send requirements to an external WM system for kitting execution.
    I need to know whether there are any system statuses to notify me when an IDOC has been created,failed and processed. If not, how do I go about creating user defined statuses for these statuses.
    Second question, which idocs should I use to confirm, teco and cancel the production orders from an external system?
    Thanks
    Evan

    HI Evan
    u can use the standard program - RBDMOIND scheduled in back ground to update the Idoc staus ,
    this helps to update the IDoc Status from
    '03     Data passed to port OK  '  to
    '12     Dispatch OK'
    status 03 indicates the IDoc is successfully transmitted to Communication Layer and the Status 12 helps to confirm the data dispatch to the receiving port.

  • Difference between Business service, Business system and Business process

    Hi,
    Can anyone tell me the difference between Business service, Business system and Business process?
    Thanks,
    Harikumar. S

    Hi,
    <b>Business system</b>
    It is a logical system from a business point of view.
    One or more logical systems that belong together from a business point of view is called a group of Business system group. A business system group represents a unit within a company or organization that can be defined according to legal, economic, administrative or geographic factors.
    The objects in a business system group are uniquely identified by a uniform numbering system.
    <b>Business process</b>
    Business procedure within an enterprise that uses resources and can involve activites from a number of different cost centers in a controlling area.
    When executing a business process, activities can be utilized for several cost centers of a controlling area.
    <b>Business service</b>
    It’s a third party system.
    All these belong to a Business Scenario which is
    Description of the flow of business processes according to a business typology. A business scenario represents a template for a business process, which runs within a particular area of a company process. All processes required to completely process the task are listed in chronological order in the scenario. Business scenarios can be described graphically, in either aggregated or detailed form (EPC). Example: Direct sale to industrial recipient
    <b>**DO REWARD POINTS IF THIS IS HELPFUL FOR YOU**</b>
    Regards
    AK

  • What is the cost and process for factory refurbish of a tx2-1375dx with a blown system board?cc=us

    What is the cost and process for factory refurbish of a tx2-1375dx with a blown system board?
    How would one go about arranging for such service?
    Why is it impossible to contact a real human for support, either via online chat or phone? 

    Last I checked I am a real human, it is just that I do not work for HP and can't speak for them. HP would not be the place I would go for a "refurbish" job. They charge an arm and a leg for out of warranty service. You simply need to find someone to replace the system board (motherboard). It is also very likely on that model that you could have your system board repaired. There are many services on ebay that will repair the motherboard at the component level. The cost would be at or under $100 or so. I have more advice to give but many times I write a detailed response only to have the user never come back. I do check my posts so if you want more ideas just please respond. The tx2-1000 was one of the models affected by the nVidia issue that caused so many HP laptops made in the 2007-2009 era to fail prematurely. 

  • System status or user status for IDOC creation and processing for prod ord

    All
    I am creating IDOCs for production orders to send requirements to an external WM system for kitting execution.
    I need to know whether there are any system statuses to notify me when an IDOC has been created,failed and processed. If not, how do I go about creating user defined statuses for these statuses.
    Second question, which idocs should I use  to confirm, teco and cancel the production orders from an external system?
    Thanks
    Evan

    For the first part of your query refer to the technical forums.
    For the second part - refer to Idoc - LOIPRO01, it has a segment for Order status, that should be of interest.
    Attn Moderators
    I think it would be better to move this thread to a technical forum, so the requester can get the most relevant information.

  • I'm trying to get a public link to my pdf file? I tried the system's process and the links don't work

    I'm trying to get a public link to my pdf file? I tried the system's process and the links don't work. I can't even copy the links I have to write them down and then enter them. Is anyone else having this problem. I've seen this question a couple times with no replies.

    Hi mariondouglas,
    Do I understand correctly that you've used Send to send a file that you've uploaded to Acrobat.com? What happens when you send to your own email address? Are you able to click the link in that email, and access the file that way?
    If you're unable to copy the email in the browser window after you've generated a public link, please clear the browser cache, and try again. Or, use a different web browser (for a list of supported browsers, see System requirements | Acrobat.com).
    Please let us know how it goes.
    Best,
    Sara

  • Oracle 11i System Profile Option - Concurrent Define and Executable

    I'm looking for what I think is a System Profile Option within Oracle Financials that will allow me to open Concurrent Program Define at the same time as Concurrent Program Executables so that I can copy and paste from one to the other. I can do this in our Dev. Environment but we recently refreshed the Test environment and I lost this ability.
    I'm using the System Administrator responsibility within 11i and am referring to where you define your concurrent programs and executables.
    I'm assuming this is a system profile option but I am unable to find it.
    Our version is 11.5.10.2

    Hello.
    I think you have the Close Other Forms check box option checked. In the main menu, choose the Tools menu and see how is this checkbox status.If it is checked, just unchek it. You will be able to open both forms at same time.
    Octavio

  • System.Diagnostics.Process.Start and UI 2004

    Can anyone tell me if (how) I can use System.Diagnostics.Process.Start to spawn external applications from a trapped item event in my add-on?
    My application model is the standard startup/sub main.  It looks like this:
    Module Startup
        Sub Main()
            Dim oAV As MyObject
            oAV = New MyObject
            ' Startup
            System.Windows.Forms.Application.Run()
        End Sub
    End Module
    MyObject contains a "New()" that sets the SBO_Application object etc.  It also contains a few subs that capture events in the sbo UI such as button presses.  Now, the trick - how do I set up my threading model correctly to allow me to launch an external application like calculator from within the UI?
    Thanks in advance!
    Ty Babcox

    It sounds like you are having a problem becuase you are launching your application (calc.exe in example) under a thread that is then closing.  You can use the invoke delegate to launch from the 'parent' thread.  You will probably have to make a delegate function and call that with me.invoke(delegate)
    Look at 'invoke' in the msdn.

  • HT1414 ipad continues to go to home screen I slide arrow to unlock, it asks if I want to unlock.  Hit cancel and process happens again b4 allowing system to unlock.

    ipad continues to go to home screen I slide arrow to unlock, it asks if I want to unlock.  Hit cancel and process happens again b4 allowing system to unlock.  Not sure if hardward or ios problem. Ant ony else seen this problem?
    Cant afford a new device at this time. 

    You can try resetting your iPad by simultaneously pressing and holding the Home and Sleep/Wake buttons until you see the Apple Logo. This can take up to 15 seconds so be patient and don't release the buttons until the logo appears.
    Try again to see if the problem persists.

  • Possible to extend java Concurrent Program and replace standard??

    Hi All!
    i have following developing need. There is a java concurrent program POXPOPDF (PO Output for Communication). The customer needs this program to do actually something complete different than printing the PO in PDF. The executable for this CP is java class PoGenerateDocumentCP in oracle.apps.po.communicate package.
    We thought that we may be able to extend that class and then in some way made OA to use the extended java class instead of the standard. This is possbile and simple for OA Framework pages unsing classes as controllers, but I don't know how it could be done for CP (if there's a way to do it without violent intervention in standard system).. Is it possbile, can anyone help me with this.
    The thing is that instead of reformatting the XML returned from PO_COMMUNICATION_PVT.POXMLGEN (function POXMLGEN in database package PO_COMMUNICATION_PVT) into PDF we want to reformat into another XML and then send it in other way to a webservice. Once I have the XML from POXMLGEN I have no problem to reformat it into another XML (I think, I have done it iwith other issues/processes). The webservice and the call to it is no problem and is already use with other purposes in other processes, but here (replaceing this stadard java class for an extension/new one) I am a little lost.
    Appreciate very much your help.
    Regards,
    Patricia

    Never mind, I see now that FND_REQUEST.SUBMIT_REQUEST() really does work, I tried with a different standard java concurrent program and it worked fine, and then I figured out that my parameters into fnd_request.submit_request for concurrent program APXVVCF4 were not correct (application short name was invalid for concurrent program).
    Thanks for the Info!

  • Concurrent Manager - Actual processes

    Oracle EBS 11.5.9 on Windows 2003
    1-In administer concurrent Managers screen.
    against STANDARD MANAGER, i am not able to see ACTUAL process where as in TARGET & RUNNING columns are showing values.
    I think it happend after cloning, on production i am able see ACTUAL processes.
    2-The problem is basically, concurrent manager processing is very slow.
    How i can troubleshoot above two points.
    Regards,

    Hi,
    1-In administer concurrent Managers screen.
    against STANDARD MANAGER, i am not able to see ACTUAL process where as in TARGET & RUNNING columns are showing values.
    I think it happend after cloning, on production i am able see ACTUAL processes. Any errors in the CM log file?
    From System Administrator responsibility, navigate to Concurrent > Manager > Administer. Query "Standard Manager", click on "Work Shifts" and verify the number of Processes.
    2-The problem is basically, concurrent manager processing is very slow.Do you run "Purge Concurrent Request and/or Manager Data" concurrent program on regular basis?
    How many rows you have in the FND_CONCURRENT_PROCESSES and FND_CONCURRENT_REQUESTS tables? Make sure it does in exceed 50K by running "Purge Concurrent Request and/or Manager Data" concurrent program.
    Regards,
    Hussein

  • Restrict concurrent user and/or session from a client

    Hi All:
    We have an application with database Oracle 10g.
    I want to add a new validation to restrict concurrent user and/or session from a client. (we have almost 60 client firms using the software to enter daily trasnactions).
    All users from all clients are connecting to the database using a common functional ID.
    What I did was:
    1) Add a column 'user_logged_in' in the master table for client and update it as Y when user from that client logged on to the system,
    2) Insert the application logon details (we can figure out the client details from this) into a global temp table,
    3) Create a logoff trigger to update the 'user_logged_in'flag in client master table by using values from global temp table when session logged off and
    4) Restrict the users from same client if the flag is 'Y'
    But the problem in this case is logoff trigger will not be executed in case if the session got killed or terminated abnormally.
    Is there any other good solution for this scenario?
    Thanks
    Robin

    >
    But the problem in this case is logoff trigger will not be executed in case if the session got killed or terminated abnormally.
    Is there any other good solution for this scenario?
    >
    A better question might be - is there any other 'worse' solution than that?
    >
    2) Insert the application logon details (we can figure out the client details from this) into a global temp table,
    >
    Meaning - if that session goes down you have NO logon details since the data isn't persistent. Is that really useful?
    There is nothing you can do to account for someone just pulling the plug on: the server, the network connection, the bridge, the router, etc. And if a user is connected, starts a long-running process and then gets disconnected the process is likely to keep running in the background until Oracle needs to talk to the user again and then realizes that they are gone.
    Meanwhile the user is trying to logon again but can't because the system thinks they are already logged on.
    >
    All users from all clients are connecting to the database using a common functional ID.
    >
    Doesn't that kind of make it harder, not easier, to track who is really connecting and using your application?

Maybe you are looking for