Erp Lab Print1

download Erp Lab Print1

of 18

Transcript of Erp Lab Print1

  • 8/2/2019 Erp Lab Print1

    1/18

    Introduction to E-Commerce and ERP Lab

    1.1 What is ERP?

    Enterprise resource planning systems (ERPs) are management information systems thatintegrate and automate many of the business practices associated with the operations orproduction aspects.

    The consumer moves through the internet to the merchants web site. From there, hedecides that he wants to purchase something, so he is moved to the online transactionserver, where all of the information he gives is encrypted. Once he has placed his order, theinformation moves through a private gateway to a Processing Network, where the issuingand acquiring banks complete or deny the transaction. This generally takes place in no

    more than 5-7 seconds.

    There are many different payment systems available to accommodate the varied processingneeds of merchants, from those who have a few orders a day to those who processthousands of transactions daily. With the addition of Secure Socket Layer technology,eCommerce is also a very safe way to complete.

    There are several basic steps involved in becoming eCommerce Enabled.

    1. Getting an Internet Merchant Bank Account2. Web Hosting3. Obtaining a Digital Certificate4. Finding a provider of Online Transactions5. Creating or Purchasing a Shopping Cart Software.

    ERP software overview. Enterprise resource planning is a term derived frommanufacturing resource planning (MRP II) that followed material requirements planning(MRP). ERP software typically handle the manufacturing, logistics, distribution, inventory,shipping, invoicing and accounting for a company. Enterprise Resource Planning or ERPsoftware can aid in the control of many business activities like sales, delivery, billing,production, inventory management, and human resources management. ERP software areoften called back office systems indicating that customers and the general public are not

    directly involved. This is contrasted with front office systems like customer relationshipmanagement (CRM) systems that deal directly with the customers, or the eBusinesssystems such as eCommerce, eGovernment, eTelecom, and eFinance, or supplierrelationship management (SRM) systems that deal.

    ERP software are cross-functional and enterprise wide. All functional departments that areinvolved in operations or production are integrated in one system. In addition to

  • 8/2/2019 Erp Lab Print1

    2/18

    manufacturing, warehousing, logistics, and Information Technology, this would includeaccounting, human resources.

    In the early days of business computing, companies used to write their own software tocontrol their business processes. This is an expensive approach. Since many of these

    processes occur in common across various types of businesses, common reusable softwaremay provide cost-effective alternatives to custom software. Thus some ERP softwarecaters to a wide range of industries from service sectors like software vendors and hospitalsto manufacturing industries and even to government departments.

    1.2 Implementation

    Because of their wide scope of application within the firm, ERP software systems rely onsome of the largest bodies of software ever written. Implementing such a complex andhuge software system in a company usually involves an army of analysts, programmers,and users, and often comprises a very expensive project in itself for bigger companies,

    especially transnational.

    Enterprise resource planning systems are often closely tied to supply chain managementand logistics automation systems. Supply chain management software can extend the ERPsoftware to include links with suppliers.

    To implement ERP software, companies often seek the help of an ERP vendor or of thirdparty consulting companies. Consulting in ERP involves two levels, namely businessconsulting and technical consulting. A business consultant studies an organizations currentbusiness processes and matches them to the corresponding processes in the ERP system,thus `configuring the ERP software to the organizations needs. Technical consulting often

    involves programming.

    Some risks to watch out for in implementing an ERP software include:

    - Incompatibility of the ERP software with the operational level legacy systems(existing/old information systems)

    - User Resistance/Revolt Users who fear being downsized may sabotage thesystem.

    - Mismatch between ERP software and Organizational culture If a systemattempts to implement best practices inappropriate to the organization, thesystem may suffer from culture clash consequences.

    - Inability to control technology- Illogical processing- Inability to stop processing quickly- Cascading errors- Repetition of Errors.- Concentration of data- Inability to substantive processing- Concentration of responsibility.

  • 8/2/2019 Erp Lab Print1

    3/18

    Today there are also web-based ERP systems. Companies would deploy web-based ERPsoftware because it requires no client side installation, is cross-platform and maintainedcentrally. As long as you have an Internet connection, accessing web-based ERP softwareis done through typical web-browsers.

    1.3 What is e-commerce?

    Most people think e-commerce means online shopping workaholics pointing theirbrowsers to Amazon.com to order an emergency present because they forgot someonesbirthday again.

    But Web shopping is only a small part of the e-commerce picture. The term also refers toonline stock and bond transactions and buying and downloading software without evergoing near a store. In addition, e-commerce includes business-to-business connections thatmake purchasing easier for big corporations. And many people hope that so-called micro

    transactions will let people pay small amounts a few cents or a few dollars to accessonline content or games.

    As for the hottest areas of e-commerce, in terms of tangible goods sold via the Internet andother electronic means (such as interactive TV), Simba Information says the biggest sellersare computer products, consumer products, books and magazines and music andentertainment products.

    Clearly, e-commerce is here to stay. International Data Corporation has projected that 46million Americans will buy $16 billion worth of goods annually by next year and $54billion by 2002. Forrester Research predicts e-commerce sales of almost $7 billion by

    2000. Looking further ahead, Morgan Stanley estimates sales of anywhere between $21billion to $15 billion annually by 2005.

    1.4 What is the future of e-commerce?

    Rest assured, there is a bright future for e-commerce. Once the details of online commerceare worked out, it and the Internet in general could reshape the structure of the businessworld.

    The huge growth of virtual communities people getting together in ad hoc interest groupsonline promises to shift the balance of economic power from the manufacturer to theconsumer. At least, thats the view of John Hagel and Arthur Armstrong, a pair of analystsat McKinsey & Company, an international management consulting firm. These virtualcommunities are already making their presence felt. Investment site Motley Fool letsmembers exchange investment advice without the benefit of a stockbroker. Parents Place isa meeting ground for parents that gives smaller vendors an avenue to reach potentialcustomer for products such as baby food and shampoo.

  • 8/2/2019 Erp Lab Print1

    4/18

    Virtual communities erode the marketing and sales advantages of large companies. Asmall company with a better product and better customer service can use thesecommunities to challenge larger competitors - something it probably couldnt do in thereal world.

    In Net Gain: Expanding Markets Through Virtual Communities, published by HarvardBusiness School Press, Hagel and Armstrong argue that rather than fight the trend, smartcompanies will help build such communities and use them to reach customers.

    1.5 Is the Government going to regulate e-commerce?

    Last year, the Senate overwhelmingly approved the Internet Tax Freedom Act, whichimposed a three-year moratorium on new Internet taxes. This act bars state or localgovernments from imposing new taxes on access to the Internet and data flowing over theInternet as well as prohibits any new e-commerce taxes.

    Local legislators are the ones champing at the bit to get a cut of the e-commerce action, andthey are not all waiting for the end of the three year moratorium. The National Associationof Counties recently unanimously approved a resolution asking Congress to impose a salestax on all online purchases.

    Local governments estimate that $5 billion annually are already lost to out-of-state mailorder business, and with the rapid rise of e-commerce, this number will only increase.While there have been some rumblings of impatience in congress, the federal governmentis urging local and state officials to respect the Internet Tax Freedom Acts ban.

    It is very likely that when the moratorium expires, the taxation situation will be in for some

    changes. There is an advisory committee already meeting to work on post moratoriumissues, and many ideas are being discussed. The Advisory Committee on ElectronicCommerce was mandated by the Internet Tax Freedom Act, and it will consider such topicsas a flat national Internet tax and ways to simplify sales tax for online purchases.

    While the feds favor no additional taxes for now, state governments are grappling with theissue individually. Texas taxes not only Internet access charges, but also all the moneycollected when content providers sell online subscriptions, as well as the fees charged byWeb developers for building sites. On the other hand, New York decreed that Internetaccess charges are not subject to state sales or telecommunications taxes. Currently ninestates tax Internet services, and six states, including California, have moratoriums on

    Internet taxes.

    Most states still dont know what to do, according to the accounting and consulting firmDeloitte & Touche, which published a comprehensive guide called Taxation inCyberspace.

    For now, e-commerce providers such as AT&T are treating Web purchases much like mail-order sales. The providers collect taxes if the merchant has a significant presence in the

  • 8/2/2019 Erp Lab Print1

    5/18

    state where the buyer resides. There are lots of gray areas. Acknowledged JamesKwock, a Web services marketing director with AT&T Networked Commerce Service,but I dont feel any pressure from tax lawyers yet.

    Theres another problem with Net taxes: The Internet crosses international borders as

    easily as it skips over state lines. President Clinton wants to turn the Internet into a free-trade zone. Japan agrees, but other countries have already indicated a willingness toregulate the Net. For example, France has long tried to mandate the use of French on Websites, while Germany has attempted to stamp out both pornography and neo-Nazi materialsonline, and Australia has regulated pornography as well. Getting international agreementon Net taxes may be the biggest hurdle to overcome.

  • 8/2/2019 Erp Lab Print1

    6/18

    EXPERIMENT No. : 1

    AIM:

    To compare the functionality of any company between non-ERP scenario & ERP

    scenario.

    ERP SCENARIO

    Enterprise Resource Planning (ERP) systems attempt to integrate several data andprocesses of an organization into a unified system. A typical ERP system will use multiplecomponents of computer software and hardware to achieve the integration. A keyingredient of most ERP systems is the use of a unified database to store data for the various

    system modules.

    ERP systems now attempt to cover all basic functions of an enterprise, regardless of theorganization's business or charter. Non-manufacturing businesses, non-profit organizationsand governments now all utilize ERP systems.

    To be considered an ERP system, a software package must provide the function of at leasttwo systems. For example, a software package that provides both payroll and accountingfunctions could technically be considered an ERP software package.

    ERP software, among other things, combined the data of formerly separate applications.

    This made the worry of keeping numbers in synchronization across multiple systemsdisappear. It standardized and reduced the number of software specialties required withinlarger organizations.

    Examples of modules in an ERP which formerly would have been stand-alone applicationsinclude: Manufacturing, Supply Chain, Financials, Customer Relationship Management(CRM), Human Resources, Warehouse Management and Decision Support System.

    The benefits of ERP implementation in organization are:1. Better Customer Satisfaction.2. Business Integration.

    3. Faster Processing and Delivery.4. Reduced overall Cost5. Reduces paper and manual work.6. Improved Quality7. Latest use of technology and many more.

    The ERP package used commonly are

    http://en.wikipedia.org/wiki/Datahttp://en.wikipedia.org/wiki/Enterprise_application_integrationhttp://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/Manufacturinghttp://en.wikipedia.org/wiki/Supply_chain_managementhttp://en.wikipedia.org/wiki/Financialshttp://en.wikipedia.org/wiki/Customer_Relationship_Managementhttp://en.wikipedia.org/wiki/Customer_Relationship_Managementhttp://en.wikipedia.org/wiki/Human_Resourceshttp://en.wikipedia.org/wiki/Warehouse_Management_Systemhttp://en.wikipedia.org/wiki/Decision_Support_Systemhttp://en.wikipedia.org/wiki/Datahttp://en.wikipedia.org/wiki/Enterprise_application_integrationhttp://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/Manufacturinghttp://en.wikipedia.org/wiki/Supply_chain_managementhttp://en.wikipedia.org/wiki/Financialshttp://en.wikipedia.org/wiki/Customer_Relationship_Managementhttp://en.wikipedia.org/wiki/Customer_Relationship_Managementhttp://en.wikipedia.org/wiki/Human_Resourceshttp://en.wikipedia.org/wiki/Warehouse_Management_Systemhttp://en.wikipedia.org/wiki/Decision_Support_System
  • 8/2/2019 Erp Lab Print1

    7/18

    1. SAP(System Application Product in Data Processing)2. Oracle(latest 10g and Oracle 11i)3. BAAN4. RAMCO5. J.D.Edward

    6. Marshall and many more.The companies provide different packages for different department e.g. Finance.HR, Accounts and Stores etc.

    Figure 1: ERP Components

    Evolution of ERP

    1960s: Inventory Control

    1970s: Material Requirement Planning (MRP)

    1980s: Manufacturing Resources Planning (MRP-II)

    1990s: Enterprise Resource Planning (ERP)

    Advantages of ERP scenario

    In the absence of an ERP system, a large manufacturer may find itself with many softwareapplications that do not talk to each other and do not effectively interface. Tasks that needto interface with one another may involve:

  • 8/2/2019 Erp Lab Print1

    8/18

    design engineering (how to best make the product) order tracking from acceptance through fulfillment the revenue cycle from invoice through cash receipt managing interdependencies of complex Bill of Materials tracking the 3-way match between Purchase orders (what was ordered), Inventory

    receipts (what arrived), and Costing (what the vendor invoiced) the Accounting for all of these tasks, tracking the Revenue, Cost and Profit on a

    granular level.

    Disadvantages

    Many problems organizations have with ERP systems are due to inadequate investment inongoing training for involved personnel, including those implementing and testing changes,as well as a lack of corporate policy protecting the integrity of the data in the ERP systemsand how it is used.

    Limitations of ERP include:

    Success depends on the skill and experience of the workforce, including trainingabout how to make the system work correctly.

    Small enterprises are often undercapitalized & are also not updated about the latestofferings in the market

    Personnel turnover; companies can employ new managers lacking education in thecompany's ERP system, proposing changes in business practices that are out ofsynchronization with the best utilization of the company's selected ERP.

    Customization of the ERP software is limited. Some customization may involvechanging of the ERP software structure which is usually not allowed.

    Re-engineering of business processes to fit the "industry standard" prescribed bythe ERP system may lead to a loss of competitive advantage. ERP systems can be very expensive to install often ranging from 30,000 US Dollars

    to 500,000,000 US Dollars for multinational companies. ERP vendors can charge sums of money for annual license renewal that is unrelated

    to the size of the company using the ERP or its profitability. Technical support personnel often give replies to callers that are inappropriate for

    the caller's corporate structure. Computer security concerns arise, for example whentelling a non-programmer how to change a database on the fly, at a company thatrequires an audit trail of changes so as to meet some regulatory standards.

    ERPs are often seen as too rigid and too difficult to adapt to the specific workflowand business process of some companiesthis is cited as one of the main causes oftheir failure.

    Systems can be difficult to use. Systems are too restrictive and do not allow much flexibility in implementation and

    usage. The system can suffer from the "weakest link" probleman inefficiency in one

    department or at one of the partners may affect other participants.

    http://en.wikipedia.org/wiki/Engineeringhttp://en.wikipedia.org/wiki/Invoicehttp://en.wikipedia.org/wiki/Bill_of_Materialhttp://en.wikipedia.org/wiki/Purchase_orderhttp://en.wikipedia.org/wiki/Inventoryhttp://en.wikipedia.org/wiki/Costhttp://en.wikipedia.org/wiki/Accountinghttp://en.wikipedia.org/wiki/Revenuehttp://en.wikipedia.org/wiki/Costhttp://en.wikipedia.org/wiki/Profithttp://en.wikipedia.org/wiki/Technical_supporthttp://en.wikipedia.org/wiki/Workflowhttp://en.wikipedia.org/wiki/Engineeringhttp://en.wikipedia.org/wiki/Invoicehttp://en.wikipedia.org/wiki/Bill_of_Materialhttp://en.wikipedia.org/wiki/Purchase_orderhttp://en.wikipedia.org/wiki/Inventoryhttp://en.wikipedia.org/wiki/Costhttp://en.wikipedia.org/wiki/Accountinghttp://en.wikipedia.org/wiki/Revenuehttp://en.wikipedia.org/wiki/Costhttp://en.wikipedia.org/wiki/Profithttp://en.wikipedia.org/wiki/Technical_supporthttp://en.wikipedia.org/wiki/Workflow
  • 8/2/2019 Erp Lab Print1

    9/18

    Many of the integrated links need high accuracy in other applications to workeffectively. A company can achieve minimum standards, then over time "dirty data"will reduce the reliability of some applications.

    Once a system is established, switching costs are very high for any one of thepartners (reducing flexibility and strategic control at the corporate level).

    The blurring of company boundaries can cause problems in accountability, lines ofresponsibility, and employee morale. Resistance in sharing sensitive internal information between departments can

    reduce the effectiveness of the software. Some large organizations may have multiple departments with separate,

    independent resources, missions, chains-of-command, etc, and consolidation into asingle enterprise may yield limited benefits.

    There are frequent compatibility problems with the various legacy systems of thepartners.

    The system may be over-engineered relative to the actual needs of the customer.

    NON-ERP SCENARIO

    Prior to the concept of ERP systems, departments within an organization (for example, thehuman resources (HR)) department, the payroll department, and the financial department)would have their own computer systems. The HR computer system (often called HRMS orHRIS) would typically contain information on the department, reporting structure, andpersonal details of employees. The payroll department would typically calculate and storepaycheck information. The financial department would typically store financialtransactions for the organization. Each system would have to rely on a set of common data

    to communicate with each other. For the HRIS to send salary information to the payrollsystem, an employee number would need to be assigned and remain static between the twosystems to accurately identify an employee. The financial system was not interested in theemployee-level data, but only in the payouts made by the payroll systems, such as the taxpayments to various authorities, payments for employee benefits to providers, and so on.This provided complications. For instance, a person could not be paid in the payroll systemwithout an employee number.

    Primary functions for Non-ecommerce scenario

    Order Requirement -> Order Accepted -> Purchase Material -> Hire Employees->

    ->Purchase raw materials and tools -> Purchase technology ->Make jobs ->Send it to theclients.

  • 8/2/2019 Erp Lab Print1

    10/18

    Helping functions:

    1. Inventory2. Marketing and advertisements3. R&D on various tools and technology.

    Goal :-

    1. To produce the customer jobs with minimum amount of time,2. minimum amount of inventory and3. High Level of customer satisfaction.

    Limitation/Disadvantage of Non-ERP scenario:-

    1. No business integration

    2. Less flexible3. Less planning capabilities4. No use of Latest technology.5. No improved access to information6. No better customer satisfaction7. Less workflow and efficiency.8. No better method to track actual costs of activities and perform activity based costing

    Let us assume that 5 dept are working to achieve the goal.Let us do a study for finding which department is not contributing toward these 3 goals.

    Inventory (Non-ERP mode):

    Steps to be followed are:1. Make storeroom.2. Hire some employees.3. Use of paper in purchasing.4. Obtain the demand.5. Try to fulfill.6. Make space in storeroom7. Purchase(if any).

    Overheads in Non-ERP Company:

    1. Salary of employees.2. Cost of paper being used.3. Depreciation cost.4. Processing cost.

    Advantages of Non-ERP System

    1. It is cost efficient.

  • 8/2/2019 Erp Lab Print1

    11/18

    2. It is a more secure system in comparison of ERP.3. It does not required highly skilled employees.

    Disadvantages of Non-ERP System

    1. Increase paper work.

    2. Increase timeliness of information by submitting monthly reports instead of daily.3. Slow response.4. Low accuracy of information with less detailed content.

    Where as if we use an ERP system

    We use a Center liaised\Distributed database system which can perform the following steps1. Different departments can input requirements.2. It can output the expected amount of item consumption in a specified environment.3. specify the need of different departments.4. Online purchasing and selling pf goods.5. Fast user Queries

    Overheads in ERP system

    1. Installation and maintenance cost.

    Advantages of ERP system

    1. Gives Accounts Payable personnel increased control of invoicing and paymentprocessing and thereby boosting their productivity and eliminating their reliance oncomputer personnel for these operations.

    2. Reduce paper documents by providing on-line formats for quickly entering andretrieving information.

    3. Improves timeliness of information by permitting, posting daily instead of monthly.4. Greater accuracy of information with detailed content, better presentation, fully

    satisfactory for the Auditors.5. Improved Cost Control.6. Faster Response and follow up of customers.7. Better monitoring and quicker resolution of queries.8. Enables quick response to change in business operation and market condition.9. Helps to achieve competitive advantage by improving its business process.10. Improves supply-demand linkage with remote locations and branches in different

    countries.11. Provides a unified customer database useable by all applications. To improves.12. International operations by supporting a variety of tax structures, invoicingschemes, multiple currencies, multiple period accounting and languages.13. Improves information access and management throughout the enterprise.14. Provides solution for problems like Y2K and Single Monitory Unit(SMU) or Euro

    Currency.

    Disadvantages of ERP System

  • 8/2/2019 Erp Lab Print1

    12/18

    1. Cost is a very important issue for an organization to consider when implementingan ERP system. The high costs of setting up an ERP system are so prohibitive thatit would be out of reach for some many small businesses.

    2. Another disadvantage would be the privacy within an ERP system.

    3. Finally, there may also be a mirror disadvantage for employees, since an ERPsystem automates many routine tasks that use to be taken by people. Now, theremay be a problem for those who have not been trained to have the skills to docertain tasks with the ERP system.

    EXPERIMENT No. : 2

    AIM:

    To write a program to implement Banker Algorithm

  • 8/2/2019 Erp Lab Print1

    13/18

    Bankers algorithm

    The bankers algorithm is a theoretical approach avoiding deadlocks in resourcescheduling. It requires resource usage limit to be known in advance . This fact is generallynot known in practical. It is usually explained using an analogy to a bank behavior. The

    customers are computer processes, money is the resources, and each customer has a creditlimit. The banker is the operating system. The bank relies on that it wont have to alloweveryone to maximize their credit at once. The bank further assumes that if a customermaximize its credit he will be able to finish his business affairs and return all the moneyback to the bank allowing the bank to server other customers. The algorithm keeps thesystem in a safe state. A system is in a safe state if there is an order in which the resourcerequests for all processes can eventually be granted, preventing deadlock. The Bankersalgorithm works by finding one such state. Processes ask for resources, they are providedonly if the system would remain in the safe state, otherwise the process is suspend untilother processes release enough resources.More formally speaking, a system is in a safe state if there exists a safe sequence. A safe

    sequence is a set of processes, , such that for a process Pi , the resourcerequest for Pi can be satisfied with the currently available resources plus the resources thatare held by Pj , where j< 1. If there are not enough resources for process P i , then process Pican wait until process Pj finishes and releases its resources. Once process Pj finishes andreleases its resources, process Pi can then be allocated all its resources, do what it needs todo, release its resources, and terminate. Once process Pi terminates, process Pi+1 can beallocated the resources it needs and do the job it needs to do and so on. If no such sequenceexists, then the system is said to be in an unsafe state, though not necessarily deadlocked.

    The Banker's algorithm is a resource allocation & deadlock avoidance algorithmdeveloped by Edsger Dijkstra that tests for safety by simulating the allocation of pre-

    determined maximum possible amounts of all resources, and then makes a "safe-state"check to test for possible deadlock conditions for all other pending activities, beforedeciding whether allocation should be allowed to continue.

    The Banker's algorithm is run by the operating system whenever a process requestsresources.[2] The algorithm prevents deadlock by denying or postponing the request if itdetermines that accepting the request could put the system in an unsafe state (one wheredeadlock could occur).

    Resources

    For the Banker's algorithm to work, it needs to know three things:

    How much of each resource each process could possibly request How much of each resource each process is currently holding How much of each resource the system has available

    http://en.wikipedia.org/wiki/Resource_allocationhttp://en.wikipedia.org/wiki/Deadlockhttp://en.wikipedia.org/wiki/Algorithmhttp://en.wikipedia.org/wiki/Edsger_Dijkstrahttp://en.wikipedia.org/wiki/Resource_(computer_science)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Banker's_algorithm#_note-1%23_note-1http://en.wikipedia.org/wiki/Banker's_algorithm#_note-1%23_note-1http://en.wikipedia.org/wiki/Resource_allocationhttp://en.wikipedia.org/wiki/Deadlockhttp://en.wikipedia.org/wiki/Algorithmhttp://en.wikipedia.org/wiki/Edsger_Dijkstrahttp://en.wikipedia.org/wiki/Resource_(computer_science)http://en.wikipedia.org/wiki/Process_(computing)http://en.wikipedia.org/wiki/Banker's_algorithm#_note-1%23_note-1
  • 8/2/2019 Erp Lab Print1

    14/18

    Some of the resources that are tracked in real systems are memory, semaphores andinterface access.

    A state is considered safe if it is possible for all processes to finish executing (terminate).Since the system cannot know when a process will terminate, or how many resources it will

    have requested by then, the system assumes that all processes will eventually attempt toacquire their stated maximum resources and terminate soon afterward. This is a reasonableassumption in most cases since the system is not particularly concerned with how long eachprocess runs. Also, if a process terminates without acquiring its maximum resources, itonly makes it easier on the system.

    Given that assumption, the algorithm determines if a state is safe by trying to find ahypothetical set of requests by the processes that would allow each to acquire its maximumresources and then terminate (returning its resources to the system). Any state where nosuch set exists is an unsafe state.

    When the system receives a request for resources, it runs the Banker's algorithm todetermine if it is safe to grant the request. The algorithm is fairly straight forward once thedistinction between safe and unsafe states is understood.

    1. Can the request be granted?o If not, the request is impossible and must either be denied or put on a

    waiting list2. Assume that the request is granted3. Is the new state safe?

    o If so grant the request

    o If not, either deny the request or put it on a waiting list

    Bankers Algorithm

    Processes request 1 resource at a time Request granted ONLY if it results in a safe state If request results in an unsafe state, it is denied and user holds resources and waits

    until request is eventually satisfied In finite time, all requests will be satisfied Can be extended to cater for multiple resource types

    Therefore, from Bankers algorithm :

    Allow a thread (process) to proceed if :

    (total available resources) - (number allocated)

    (maximum remaining that might be needed by the thread (process))

    So Bankers algorithm ensures that there is no deadlock and it is not as restrictive asdeadlock prevention.

    http://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Semaphore_(programming)http://en.wikipedia.org/wiki/Interface_(computer_science)http://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Semaphore_(programming)http://en.wikipedia.org/wiki/Interface_(computer_science)
  • 8/2/2019 Erp Lab Print1

    15/18

    Limitations:

    Fixed number of resources and users

    Guarantees finite time - NOT - reasonable response time

    Needs advanced knowledge of maximum needs

    Not suitable for multi-access systems Unnecessary delays in avoiding unsafe states which may not lead to deadlock

    PROGRAM

    #include #include int main (int argc, char ** argv){int num_resources; /* The number of resources */

    int num_customers; /* The number of customers (processes) */int ii, jj; /* A couple of scratch variables for loops */int * existing_resources; /* An array of the total resources existing */int * available_resources; /* An array of currently available resources */int ** current_allocation; /* A 2-dimensional array with one row per

    customer, one column per resource, givingthe current allocations of resources tocustomers */

    int ** requested_resources; /* A similar 2-dimensional array giving theadditional resource requests that eachcustomer might make *.

    cout

  • 8/2/2019 Erp Lab Print1

    16/18

    cerr

  • 8/2/2019 Erp Lab Print1

    17/18

    while (!done) {trials = 0;freed = 0;for (ii=0; ii < num_customers; ii++) {if (requested_resources[ii]) {

    trials++;failed = 0;for (jj = 0; jj < num_resources; jj++) {if (requested_resources[ii][jj] > available_resources[jj] ) {failed = 1;cout

  • 8/2/2019 Erp Lab Print1

    18/18

    How many of resource 1 are currently allocated to customer 0? 2How many maximum of resource 1 would customer 0 like to have? 3How many of resource 2 are currently allocated to customer 0? 2How many maximum of resource 2 would customer 0 like to have? 2How many of resource 3 are currently allocated to customer 0? 1

    How many maximum of resource 3 would customer 0 like to have? 2Tell me about the resources for customer 1How many of resource 0 are currently allocated to customer 1? 1How many maximum of resource 0 would customer 1 like to have? 1How many of resource 1 are currently allocated to customer 1? 0How many maximum of resource 1 would customer 1 like to have? 2How many of resource 2 are currently allocated to customer 1? 3How many maximum of resource 2 would customer 1 like to have? 3How many of resource 3 are currently allocated to customer 1? 3How many maximum of resource 3 would customer 1 like to have? 4

    Tell me about the resources for customer 2

    How many of resource 0 are currently allocated to customer 2? 1How many maximum of resource 0 would customer 2 like to have? 1How many of resource 1 are currently allocated to customer 2? 1How many maximum of resource 1 would customer 2 like to have? 1How many of resource 2 are currently allocated to customer 2? 1How many maximum of resource 2 would customer 2 like to have? 5How many of resource 3 are currently allocated to customer 2? 0How many maximum of resource 3 would customer 2 like to have? 0

    Satisfying customer 0Satisfying customer 1Satisfying customer 2The state is safe!!!