当前位置:天才代写 > JAVA代写,java代考-JAVA作业代写免费Moss检测 > Quiz代考help试期末演示word回答问题:Programming in Java quiz help

Quiz代考help试期末演示word回答问题:Programming in Java quiz help

2017-12-18 08:00 星期一 所属: JAVA代写,java代考-JAVA作业代写免费Moss检测 浏览:1183

A Event Driven Programming in Java

event-driven programming is a programming mode in where the logic flow of the program is decided by events or user actions like clicking the mouse, pressing the key or messages from other programs. Event-driven programming is the dominant approach used in GUI

 

In terms of Java for event driven programming, basically we have three components: the trigger, the listener, and the response.  The trigger is usually something that the user interacts with(JButton) which can fire a event in specific situation, the listener is listening for a event to happen under a particular trigger, for example JButton can register listener by addActionListener() function call, response is the handler to a happened event.

 

B Process

 

A process is defined as an entity which represents the basic unit of work to be implemented in the system, which is an instance of a computer program that is being executed. It contains the program code and its current activity. 

 

C Thread

 

A thread is a basic unit of CPU utilization, consisting of a program counter, a stack, and a set of registers, ( and a thread ID. ) , which is the smallest unit of processing that can be performed in an OS. In most modern operating systems, a thread exists within a process – that is, a single process may contain multiple threads.

 

D Singleton

 

Singleton is a type of  creational design pattern in OO programming. involves a single class which is responsible to create an object while making sure that only single object gets created. This class provides a way to access its only object which can be accessed directly without need to instantiate the object of the class. Usually by making the class constructor to be private

 

E Why use thread instead of Process

 

Advantages of Thread over Process

1. Responsiveness: If the process is divided into multiple threads, if one thread completed its execution, then its output can be immediately responded.

 

2. Faster context switch: Context switch time between threads is less compared to process context switch. Process context switch is more overhead for CPU.

 

3. Effective Utilization of Multiprocessor system: If we have multiple threads in a single process, then we can schedule multiple threads on multiple processor. This will make process execution faster.

 

4. Resource sharing: Resources like code, data and file can be shared among all threads within a process.

Note : stack and registers can’t be shared among the threads. Each thread have its own stack and registers.

 

5. Communication: Communication between multiple thread is easier as thread shares common address space. while in process we have to follow some specific communication technique for communication between two process.

 

6. Enhanced Throughput of the system: If process is divided into multiple threads and each thread function is considered as one job, then the number of jobs completed per unit time is increased. Thus, increasing the throughput of the system.

 

 

 

 

    关键字:

天才代写-代写联系方式