Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementation and Experimentation of Producer- Consumer Synchronization Problem 404210004 呂鴻洋 Introduction Producer-consumer problem is one classical.

Similar presentations


Presentation on theme: "Implementation and Experimentation of Producer- Consumer Synchronization Problem 404210004 呂鴻洋 Introduction Producer-consumer problem is one classical."— Presentation transcript:

1 Implementation and Experimentation of Producer- Consumer Synchronization Problem
呂鴻洋 Introduction Producer-consumer problem is one classical example of bounder buffer synchronization problems, and synchronization is needed to prevent errors such as consumers getting items out of the empty queue. The variations of producer-consumer problem can be run on both single and multi-processors systems. However, most of these simulators used for last studies only allow user to experiment in the context of a single producer and a single consumer. To address this limitation, we propose a simulator that allows user to study producer-consumer synchronization problem in three different contexts such as simple producer-consumer problem, producer-consumer problem in a single processor system and producer-consumer problem in multi-processing system. Conclusions This simulator provides a facility for the user to experiment with three different contexts such as simple producer- consumer problem, producer-consumer problem in a single processor system and producer-consumer problem in multi- processing system. In addition, users can carry out comparative evaluation among different contexts in a repeatable and controllable environment as to gain insight on the best model to use in certain situations. All developed modules of the simulator guarantee synchronization of processes and satisfy necessary requirements to provide solution to the critical section problem. Capability of running a trace-driven simulation can be incorporated in the existing system by developing a software module that can translate the trace of events recorded on a real system, into the format of input data file. The input data file so generated then can be used to run the simulation. Results This section presents the experiments that have been carried out to evaluate the efficiency of the simulator in simulating the different contexts of producer-consumer synchronization problem. We have performed a series of experiments by varying the input parameters as to study the following: 1.Relationship between Simulator Output and Elapsed Time: This experiment is aimed at quantifying the effect of elapsed time on the number of items produced and consumed. It is also meant to see the effects of elapsed time for the producer- consumer problem in single processor and multi-processor environments. For a single processor environment, we run three set of experiments with the following constant input parameters: three producers, three consumers, buffer size 10 and one CPU. We varied the elapsed time for each experiment. As for multi-processors environment, we have kept the same value of parameters except for number of CPUs. Figure 2 depicts the sample result of this experiment for three different elapsed time; 20, 40 and 60 seconds. The results attest that elapsed time have significant effects of number of items produced and consumed in both type of environments. Fig. 3 Simulation results for relationship between items produced/ consumed and number of CPUs 3. Relationship between Simulator Output and Buffer Size The performance of the simulator with regards to buffer size was computed via this experiment. In this case, the other entire parameters are kept constant and only buffer size is varied. Three sets of experiment have been conducted for three types of environment; single (set number of CPU to 1) and multiprocessor (set number of CPU to 2 and 3). The results for this experiment are depicted in Figure 4 with three different buffer sizes : 10, 15 and 20 . The results demonstrate that for all environments, simulator output (number of items produced and consumed) increases as the buffer size increases. They are not linearly proportional although the buffer size was increased linearly. Significant increased can be seen when buffer size was increased from 15 to 20. Materials and methods The simulator has been developed as a comprehensive software package which can run self-driven simulation, generates useful data and provides a user-friendly environment. The system is designed to run on Windows and is written using Java. There are 3 producer-consumer models, namely simple producer-consumer problem, producer-consumer problem in single processor environment, and producer-consumer problem in multi-processor environment. Figure 1 presents the class diagram used for the simulator. There are 5 major classes, listed as followed: ProducerConsumerAppletClass: This is the main class of a Java applet file for the simulator IntQueueClass: This class contains the control of execution of the producer and consumer. ProducerClass: Producer's main activity is to call the enqueue method in IntQueue class ConsumerClass: Consumer's main activity is to call the dequeue method in IntQueue class MessageCanvas Class: This class provides message canvas for the applet GUI Literature cited Stefano, A. D., Bello, L. L., Santoro, C Synchronous Producer-consumer transactions for real- time distributed process control. In Proceedings of the IEEE International Workshop on Factory Communication Systems. Juiz, C., Puigjaner, R Improved performance model of a real-time software element: the producer- consumer. In Proceedings of the Second International Workshop on Real-Time Computing Systems and Applications. Zhang, Y., Zhang, J., Zhang, D Implementing and testing Producer-consumer problem using aspect- oriented programming. In Proceedings of the Fifth International Conference on Information Assurance and Security. Shen, C Discrete-event simulation on the Internet and the web. Future Generation Computer Systems, vol. 17, Hilzer, Jr., R. C Synchronization of the Producer/Consumer problem using semaphores, monitors, and the Ada Rendezvous. Operating Systems Review, vol. 26, Robbins, S Experimentation with bounded buffer synchronization. In Proceedings of the 31st SIGCSE Technical Symposium on Computer Science Education. Fig. 4 Fig. 2 Simulation results for relationship between items produced/consumed and elapsed time for single and multi-processors environments 2.RelationshipbetweenSimulatorOutputand Number of CPUs To study this relationship, we performed three sets of experiments with the following constant input parameters: three producers, three consumers, buffer size 10 and elapsed time of 20 seconds. Each set of experiment has been run with different number of CPUs. Output of the simulator is measured in terms of number of items produced and items consumed. Figure 3 shows a sample result for this experiment. The results show that the output of the system increases as the number of CPUs increases.


Download ppt "Implementation and Experimentation of Producer- Consumer Synchronization Problem 404210004 呂鴻洋 Introduction Producer-consumer problem is one classical."

Similar presentations


Ads by Google