Literature Review On Car Parking System Information Technology Essay

As the first of the project, the Author decide to write a brief history of car parking system and its processes so as to enlighten and understand clearer what the project is all about. Some of the features of the current car parking systems will be documented here, together with the major and general types of car parking system. The author hopes to find and document some basic advantages, disadvantages, and symbols used in car parking area.

The chapter is also going to explore the product of the research conducted on existing car parking systems. The scope of this chapter is basically to identify some car parking system and compare them, to produce some limitations of the current system. The author will then propose some solutions to implement from the problems being identified. All of the above findings will be hopefully documented at the end of this chapter.

Definition

Car parking system is a system that is used to help managing cars in parking area in other to avoid congestion and arrange cars in an allocated position. The system also helps to track how many cars pass through the gate and the duration taken by each, and then it will calculate the amount of money a car should pay when exiting. Car parking system is being used in many congested area or location where there are many meeting point of people like where there are more than one shopping complex near to each other or where there is megamall or stadium. For example like Sunway pyramid, Lowyat and Timesqure, and Midvaley megamall all in Malaysia.

Types of car Parking System

Based on the authors’ research, there are mainly four categories of car park guidance systems using different technologies – wired sensor-based, wireless sensor-based and image-based, counter-based.

:

Wired Sensor-Based

Wired sensor-based system is using detection sensors such as ultrasonic sensors which are installed at each parking lot. These sensors are wired to a central control unit that store and manage the parking occupancy information. This information is then forward to display panels at intentional locations in the car park. The display panels provide information, direction and guide the drivers to vacant parking lots.

Wireless Based

With the advancement of wireless technologies, wireless based methods have been employed in parking guidance systems. Wireless sensors nodes are deployed and each parking lot is equipped with one node. The sensor board is equipped with the sensors of light, temperature, acoustic and a sounder. In using wireless technologies, disadvantage in employing sensor at each parking lot is still present and can be very costly as each sensing unit is usually attached with a processing unit and a transceiver.

Image based

Image based techniques or some people call it as video sensor techniques. There are arguments concerning the viability of using image-based techniques. The disadvantages are video sensor is energetically expensive and video sensor can generate large amount of data which can be difficult to transmit in a wireless network.

Counter-based

The last category of car park guidance systems use is Counter-based systems which use sensors to count the number of vehicles entering and exit a car park area. This can be gate-arm counters and induction loop detectors located at the entrances and exits. This system can give information on the total number of vacant lots in a closed car park area, but does not help much in guiding the driver to the exact location of the vacant lots.

General features of Car Parking System

Enable the driver to collect ticket upon entrance: car Parking system should be able to allow the driver to get his ticket after he press the button of the gate barrier.

The system should record the entire cars that pass through the entrance.

The system should allow the gate to open whenever a driver has press the button and take his ticket.

Allow the drivers to make payment: if it’s of commercial use, the system should enable the drivers to make payment of their charges before exiting.

Allow the driver to exit: if the driver has paid his charges and require exiting, the system should open the gate to allow him exiting.

Process of Car parking System

From the research conducted, the author can state that, there is not much direct interaction between the system and the user. Though some parking systems have different procedures, but for a parking system like in Sunway pyramid, the author got to understand that the process is generally as follows.

The customer presses the button on the machine; ticket will come out from it and the customer take his ticket and then the gate will open. The customer will now proceed to the available space. The available spaces are known by the green light bulb on top of each available lot. The red light on top of parking lot indicate either the space is being reserved or there is car parked at it.

For the process of exiting, if the customer is using “touch and go” (Malaysian prepaid card), there is a sensor provided which will read the card and if there is enough money the system will deduct the amount of the charges.

But if the customer is going to pay cash there are available paying machines which the customer will insert his ticket and the system will read the ticket, estimate the hours spent and calculate the amount to be paid by the customer. Customer should insert the money stated by the system into machine. The system will validate the ticket and assign 15minutes on it which is enough for a person to his vehicle to the nearest exit gate.

Advantages of Car Parking System

The automated parking system increases the number of cars that can be parked in a garage. It provides more parking spaces since the cars are well organised parked.

If you use automated parking system, you will need only a less area of land for building a garage.

This system enables safe parking of cars as compared to the ramp-style parking facilities.

This method of parking is so convenient for the drivers and they need not have to walk in search of parking spaces.

This system reduces the maintenance costs of the garages since it significantly lowers the ventilation and lighting requirements and no need of costly deck repairs as well.

As said earlier, the chances of vehicle getting damaged due to improper parking are considerably reduced in automated car parking system.

With automated car parking system, there are no or very minimal chances of the vehicle getting lost. But, this is not the case in traditional parking method.

Existing Car parking System

In many cities today, several car parking systems can be found in different parking areas or complex. The parking systems help both the users and the drivers to have a conducive and free environment for their parking activities using. Thus, the author has decided to choose the following parking system to compare for his review of the existing systems:

Sunway pyramid car parking system

C:ImagesKk27042010074.jpg

Figure 1.1: slot machine, (Sunway, 2010).

Some facility attached to the system

C:ImagesKk27042010077.jpgC:ImagesKk27042010075.jpg

Figure 1.2: parking space, (Sunway, 2010).

Left picture-reserved lot(red light) right picture-available space(green light)

Car Park Occupancy Information System (COINS)

Figure 1.1 http://www.iaeng.org/IJCS/issues_v35/issue_1/IJCS_35_1_02.pdf

Lowyat car parking system

The Author is going to use some criteria to compare and evaluate the existing systems. The criteria are:

Information on available space:

This is based on the information provided by each system on the available space inside each of the parking area.

Reliability:

This will assess how reliable is the system to its users. The services it provides both to the admin and customers.

Information on the number of cars:

The information each system provide on how many cars are inside each of the parking area.

Help and Support:

This principle will be used to evaluate the system ability to provide customer support through the different means available.

Reservation:

The criteria used to assign a particular lot to a particular parson such as administrator or for other purposes.

Using the above evaluation criteria, the Author is going to compare the systems using 3 as the highest value and 1 as the lowest.

S/N

Criteria

Sunway

Lowyat

COINS

I.

Information on available space

3

1

2

II.

Reliability

3

2

2

III.

Information on the number of cars

2

2

2

IV.

Help and Support

3

1

2

V.

Reservation

2

1

1

Table 1.0 Comparison on the existing car parking systems

Strengths of Existing Systems

The interface design of most of the systems is made simple and rare advertisements are displayed. This permits users to perform their activities effectively.

There is no restriction or limitation of time for a car to spend in each parking area.

All the system provide very affordable price to the customer. The charges are base on hours spend by a car in the parking area.

Limitations of the Existing Systems

None of the system is providing the information of each car (plate number). For security purpose. For example security agency want know the car that are inside the parking area for traceability.

The system do not assign car to a specific parking lot and this result in roaming of cars inside the area in searching of parking space.

Some of the system does synchronize the free parking zones after the vacation of vehicle.

Possible Solutions

The possible way to solve those problems is by using the computer-based system with some additional features or functionality. Some of the features are:-

Assigning the bay number to a car from the entrance gate

Synchronizing the free parking zones after the vacation of each car.

To eliminate the long travelling of vehicle by assigning the car to the nearest possible lot.

The use of sensor at each lot can be avoided since the car is being assigned to a specific lot. There by reducing the cost of developing and the cost of maintaining the area.

Also like stated in the study of COINS system light is very crucial to sensor because it helps in detecting the presence of vehicle. Insufficient light will cause the system to perform improperly. But in the case computer base system all this will not be a factor.

Summary

From the research and comparisons being conducted by the author on several types of the car parking systems, the author have come to understand clearer the criteria used to judge and rank parking systems online. Hence, the evaluation has educated the author a lot about car parking systems and how they operate. The problems being identified by the author in the existing systems has made clear what mistakes should be avoided in this project to make it unique, acceptable, and user friendly.

CHAPTER 2.0 SIMULATOR

2.1 Introduction

The term simulation is defined as the process of creating an abstract representation of an existing or proposed system in order to identify and understand those factors which control the system and/or to predict or forecast the future behavior of the system. Almost every system which can be quantitatively explained using equations and/or rules can be simulated.

Read also  Banking Industry Because There Are Always Information Technology Essay

The essential purpose of simulation is to shed light on the fundamental mechanisms that control the behavior of a system. More practically, simulation can be used to determine what you can do to influence that future behavior. That is, simulation can be used to forecast the way in which the system will develop and respond to its surroundings, so that you can recognize any necessary changes that will help make the system perform the way that you want it to. (Goldsim 2010)

An example of a use of a computer simulator might be an engineering company working on designing a better wing for aircraft. Rather than spending resources developing prototypes of each new design, and testing them in wind tunnels or on real aircraft, a simulation can be run as a substitute. (wisegeek, 2003)

Computer simulation is the discipline of designing a model of an actual or theoretical physical system, executing the model on a digital computer, and analyzing the execution output. To understand actuality (reality) and all of its complexity, we must develop artificial objects and dynamically act out roles with them. Computer simulation is the electronic counterpart of this type of role playing and it serves to drive synthetic environments and virtual worlds. (wisegeek, 2003)

Simulation of a system can be done at many different levels of fidelity so that whereas one will think of physics-based models and output, another may think of more abstract models which yield higher-level, less detailed output as in a queuing network. Models are designed to provide solution at a given abstraction level. The more in depth the model, the more detailed the output. The kind of output you need will imply the type of model you will employ. (wisegeek, 2003)

Simulation Technique

To simulate something physical, you will first need to create a mathematical model which represents that physical object. Models can take many forms including constraint, declarative, functional, spatial or multimodal. A multimodal is a model containing multiple integrated models each of which represents a level of granularity for the physical system. The next task, once a model has been developed, is to invoke the model on a computer that is, you need to create a computer program which steps through time while updating the state and event variables in your model. There are lots of ways to step through time. You can, for instance, leap through time using event scheduling or you can make use of small time increments using time slicing. You can also simulate the program on a massively parallel computer. This is called distributed and parallel simulation. For many large-scale models, this is the only feasible way of getting answers in a reasonable amount of time.

When to Use Simulation

Simulation is a decision analysis and support tool.  Simulation software allows you to assess, compare and optimize other designs, plans and policies.  As such, it provides a tool for explaining and defending decisions to a variety of stakeholders.

Simulation should be used when the penalty of a proposed action, plan or design cannot be directly and immediately observed (i.e., the consequences are delayed in time and/or dispersed in space) and/or it is simply impractical or prohibitively expensive to test the alternatives directly. For example, when developing a strategic plan for a company, the impacts are likely to take months (or years) to show up.

Simulation is particularly important when there is significant uncertainty regarding the outcome or consequences of a particular alternative under consideration.

The reality is not available (the technology is not in place to realize the concept)

The reality is too dangerous (safety critical test)

To save money and time (development) (VIP, 2010)

Perhaps most importantly, simulation should be used when the system under consideration has complex interactions and requires the input from multiple disciplines.  In this case, it is complicated for any one person to easily understand the system.  A simulation model can act as the framework to assimilate the various components in order to better realize their interactions. As such, it becomes a management tool that keeps you focused without getting lost in unimportant details.

Types of Simulation

Parallel simulation

Parallel discrete event simulation is concerned with execution on multiprocessor computing platforms containing multiple central processing units (CPUs) that interact frequently, e.g., thousands of times per second (PARALLEL AND DISTRIBUTED SIMULATION SYSTEMS, 1997).

2.3.1.1. Example of parallel simulation is parallel simulation system for freeway traffic flows which is being developed with a network of PCs under the Windows.NET environment. Basic segment types of a freeway were recognized and existing macroscopic models were tailored for each segment type. The parallel algorithm first divides the whole section of a given freeway into multiple subsections depending on the number of PC’s available in a network and the computational complexity of each subsection. Flows of each traffic sub section are simulated in parallel and the data at the internal boundaries between two consecutive subsections are exchanged through a communication function at every time step.

Distributed simulation

Distributed simulation is concerned with the execution of simulations on loosely coupled systems where interactions take much more time, e.g., milliseconds or more, and occur less often. It includes execution on geographically distributed computers interconnected via a wide area network such as the Internet (PARALLEL AND DISTRIBUTED SIMULATION SYSTEMS, 1997).

In both cases the execution of a single simulation model, perhaps composed of several simulation programs, is distributed over multiple computers.

Benefits of Simulation

Parallel and distributed simulation systems can provide substantial benefit to these applications in several ways:

1. Execution times of analytic simulations can be reduced by subdividing a large simulation computation into many sub-computations that can execute concurrently. One can reduce the execution time by up to a factor equal to the number of processors that are used. This may be important simply because the simulation takes a long time to Execute, e.g., simulations of communication networks containing tens of thousands of nodes may require days or weeks for a single run.

2. Very fast executions are needed for on-line simulations because there is often very little time available to make important decisions. In many cases, simulation results must be produced in seconds in order for simulation results to be useful. Again, parallel simulation provides a means to reduce execution time.

3. Simulations used for virtual environments must execute in real time, i.e., the simulator must be able to simulate a second of activity in a second of wall clock time so that the virtual environment appears realistic in that it evolves as rapidly as the actual system. Distributing the execution of the simulation across multiple processors can help to achieve this property. Ideally, scalable execution can be obtained whereby the distributed simulation continues to run in real time as the system being simulated and the numbers of processors are increased in proportion.

(PARALLEL AND DISTRIBUTED SIMULATION SYSTEMS, 1997).

Time Parallel Simulation

Time-parallel simulation methods have been developed for attacking specific simulation problems with well-defined objectives, e.g., measuring the loss rate of a finite capacity queues of an ATM multiplexer (PARALLEL AND DISTRIBUTED SIMULATION SYSTEMS, 1997). Time-parallel algorithms divide the simulated time axis into intervals, and assign each interval to a different processor. This allows for massively parallel execution because simulations often span long periods of simulated time.

A central question that must be addressed by time parallel simulators is ensuring the states computed at the “boundaries” of the time intervals match. Specifically, it is clear that the state computed at the end of the interval [Ti-1, Ti] must match the state at the beginning of interval [Ti, Ti+1]. Thus, this approach relies on being able to perform the simulation corresponding to the ith interval without first completing the simulations of the preceding (i-1, i-2, … 1) intervals.

Because of the “state-matching” problem, time-parallel simulation is really more of a methodology for developing massively parallel algorithms for specific simulation problems than a general approach for executing arbitrary discrete event simulation models on parallel computers. Time parallel algorithms are currently not as robust as space parallel approaches because they rely on specific properties of the system being modeled, e.g., specification of the system’s behavior as recurrence equations and/or a relatively simple state descriptor. This approach is currently limited to a handful of applications, e.g., queuing networks, Petri nets, cache memories, and multiplexers in communication networks.

(PARALLEL AND DISTRIBUTED SIMULATION SYSTEMS, 1997).

Smart Tools

The most basic reason for which people choose smart tools is to be able to automate simple things, for example like in the smart homes lighting, heating and air conditioning controls. So it is in the reservation of lots and assigning of parking lot in the car parking complex.

Another important aspect coming from the usage of a smart tools simulator is energy conservation.

Smart tools could be divided into two main categories:

• Programmable tools – are those programmed to perform an action triggered by an input detected,

• Intelligent tools – are those that possess some kind of intelligence that govern its operation. (Smart House Simulation Tool,2006)

2.1 Programmable tools

Programmable tools will be those, whose reactions are based only on simple inputs, and possess no built-in intelligence. Such a tool for a predefined input (from either sensor(s) or user controller(s)) has a predefined (programmed) set of actions to perform. Examples of such actions might be e.g. detection of car at an entrance of parking area, or selection of parking areas. All these are predefined settings by a user in system.

Virtually all of currently manufactured and sold ‘smart tool’ systems belong to this group. With mass production it was possible to lower the end-user price to a level acceptable by middle-class customers – cost can lie between 50 and 120 (and up) Euro per square meter (poradnik 2006), depending on a set of desired features and controlled operations.

The biggest problem with this type of smart tools is that they have to be reprogrammed when some of the features become unnecessary and/or added. That presents a problem for many people and requires calling a technician to get the job done. Hence increasing tension to develop some smart tools solution that – basing on artificial intelligence – will adapt its operation to changing user behaviour. A tool that will not have to be first programmed and then reprogrammed all the time. A tool that will think how to make a user satisfied, lower his workload and lower the tool operation cost at the same time.

That tension leads to development of the tool that belongs to the second category.

2.2 Intelligent Tools

They represent the state-of-the-art technology. Those type of installations are driven by artificial intelligence, and instead of having to be programmed they are able to learn (i.e. program themselves) basing on observation of inhabitants behaviour over a period of time.

It one of the first successful implementations was well known Adaptive House developed by M. Mozer at University of Colorado back in 1998.

Complete system could be decomposed down to building blocks, which could be grouped into following categories:

• Data mining

• Decision making

Read also  Role of Information Systems in Business

2.2.1. Data mining

It is an area known from e.g. statistics or pattern recognition. It could be defined as searching large volumes of data for patterns.

In case of intelligent parking system, it will be implemented as looking for a specific behavior pattern through the saved logs of past activities, and trying to match the specific situation to a previously observed one.

One problem is that constantly growing amount of data (from actuators operation) demands a method for storage enabling short data access time. Second problem is to fine tune a method to ‘mine’ the data out from the database, so it can be used by the next stage of the intelligent car parking system. Several techniques to perform these operations are presented with some details in (Causal Reasoning for Alert Generation in Smart Homes,2006).

Having (possibly close) matched the current scenario to one from the past, that module passes the data to the next, far more complicated module that is responsible for making decisions.

2.2.2. Decision Making

The role of the Decision Making section is, as name implies, to make a decision of what action should be taken by the system, basing on the input from sensors and data fed by data mining unit. There is plenty of logic that could be implemented here. Decisions have to be performed accurately, because some everyday life situations can be potentially dangerous.

Second aspect is developing logic for intelligent system is a major task, far beyond the capability of a single person, and is supposed to be carried out by a group of researchers, in most of the cases they are university scientists.

2.3 Smart Tool System/Simulator In Car Park

Smart tool systems concentrate on providing assistance to both admin and customer while they are dealing with their daily routine. Most simple solutions control only the detection of car and time at entrance, then issue ticket to the driver, basing on pre-programmed settings or simple input. With adding more types of actuators operating new kinds of devices we can increase number of features in our smart tool of car parking system, enabling it to control more aspects of system operations, like reservation of space, capturing car number and converting it to the editable format which can be as one of the details in recognizing the vehicle and the driver, and provision of security. The most important extension, still being in experimental stage and waiting for deployment in broad scale, is implementing intelligence to collect data from this complicated inputs, process them, and control system in an adaptive way.

Those are the features necessary to create a smart tool. In case of creating a smart tool simulator, many things are simpler. We do not have to create the entire technical infrastructure, because action takes place on the computer display. However, we have to give user a way to define a tool outline, to place and configure inputs, and a framework to simulate all events taking place in the car parking complex.

2.4 Requirements for the Simulator

The smart tool simulator is supposed to fulfill the following conditions:

1. Should be easy to use, to attract possibly broadest audience.

2. Should enable defining a tool outline, so that user can define a tool on his choice, instead of playing only with built-in templates.

3. Should enable user to bind a specific action to specific input (basic rule of operation of a programmable tool). Example: driver entering the area is detected by pressing the button, and then the operation automatically starts. (Smart House Simulation Tool,2006)

Advantages of Simulation

Simulators are able to provide users with practical feedback when designing real world systems. This allows the developers to determine the correctness and efficiency of a design before the system is actually constructed. Consequently, the user may discover the qualities of alternative designs without actually physically building the systems. By investigating the effects of specific design decisions during the design phase rather than the development phase, the overall cost of building the system diminishes significantly.

Simulators permit system designers to study a problem at several different levels of abstraction. By approaching a system at a higher level of abstraction, the designer is better able to understand the behaviors and interactions of all the high level components within the system and is therefore better equipped to counteract the complexity of the overall system. This complexity may simply overpower the designer if the problem had been tackled from a lower level.

 Simulators can be used as an effective way for teaching or demonstrating concepts to users. This is particularly true of simulators that make intellectual use of computer graphics and animation. Such simulators dynamically show the behavior and relationship of all the simulated system’s components, thereby providing the user with a meaningful understanding of the system’s nature. (Donald, 1996)

Disadvantages of simulation

Expensive to build a simulation model.

Expensive accomplish simulation.

Sometimes it is difficult to understand the simulation results.

(Meng Xiannong 2002)

Importance of simulation

You may wonder whether simulation must be used to study dynamic systems. Simulation is often essential in the following cases:

The model is very complex with many variables and interacting components. E.g. flight simulator.

The underlying variables relationships are nonlinear

The model contains random varieties. E.g. Science-based simulations

The model output is to be visual as in a 3D computer animation.

(IST 2010).

The power of simulation is that, even for easily solvable linear systems a uniform model execution technique can be used to work out a large variety of systems without resorting to a “bag of tricks” where one must choose special purpose and sometimes mysterious solution methods to avoid simulation (The Art and Science of Digital World Construction, 1995).

Another important characteristic of the simulation technique is that one can build a simulation model to replicate the actual system. When someone uses the closed-form approach, the model is sometimes twisted to suit the closed-form nature of the solution method rather than to accurately represent the physical system. A harmonious concession is to tackle system modeling with a hybrid approach using both closed-form methods and simulation. For example, we might initiate to model a system with closed-form analysis and then progress later with a simulation. This evolutionary system is often very effective (The Art and Science of Digital World Construction, 1995).

Conclusion

In this chapter, advantages of smart tool technologies were outlined, together with a short classification of currently available solutions. Distinction between programmable tool and intelligent tool were outlined, basing primarily on the presence or absence of a self-learning logic unit, trying to fit the car park infrastructure operation to inhabitant behavior that may change over time. Features implemented in current projects were outlined and summarized, and given as a brief requirements list such a smart car park simulator should fulfill. Those requirements will be considered in the design issues that will follow later in the project.

Parallel and distributed simulation technologies address issues concerning the execution of simulation programs on multiprocessor and distributed computing platforms. These technologies find applications in high performance computing contexts as well as in the creation of geographically distributed virtual environments.

CHAPTER 3: MULTITHREAD

Introduction

In this chapter the Author is going to discuss on multithreading. Multithreading is the technique that support two or more thread of the same program to run concurrently. This can happened in the java program and can help in managing the activity of the parking complex gate. Because most of these kind of complex are having two gates, one of the gate it is use for the entrance and other for the exit. This can only be happen, unless the runner is a Java program, because two parts of the same Java program can run concurrently by using multithreading. The author is going to discuss about multithreading and how to run parts of your program concurrently in this chapter.

Processes

A process is a heavyweight entity that lives inside the kernel. It consists of the stack, data, address space, registers, memory maps, file descriptors, kernel states, virtual memory, user IDs, and so on. (mswspt, 2010).

Threads

A thread is a lightweight entity that can live in the user space or the kernel and consists of registers, stack, and data. Multiple threads distribute a process, that is, they share the address space, file descriptors, user IDs, virtual memory, and so on. The threads contained by a process share data, and they can see each other. (mswspt, 2010).

A thread can be in one of four states:

Running   A thread is being executed.

Suspended   Execution is paused and can be resumed where it left off.

Blocked   A resource cannot be accessed because it is being used by another thread.

Terminated   Execution is stopped and cannot be resumed.

All threads are not the equal (same). Some threads are more essential than other threads and are giving higher priority to resources such as the CPU. Each thread is assigned a thread priority that is used to decide when to switch from one executing thread to another. This is called context switching (Intelligent Transportation Systems, 2007).

A thread’s priority is comparative to the priority of other threads. That is, a thread’s priority is unrelated if it is the only thread that is running. A lower-priority thread runs just as fast as a higher-priority thread if no other threads are executing at the same time.

When the rules of context switching are being applied thread priorities are used. These rules are:

A thread can willingly yield to another thread. In doing so, power is turned over to the highest-priority thread.

A higher-priority thread can prevent a lower-priority thread for use of the CPU. The lower-priority thread is paused regardless of what it’s doing to give way to the higher-priority thread. This is called preemptive multitasking.

Threads of the same priority are processed based on the rules of the operating system that is being used to run the program. For example, Windows uses time slicing, which involves giving each high-priority thread a few milliseconds of CPU cycles, and keeps revolving among the high-priority threads. In Solaris, the first high-priority thread must willingly yield to another high-priority thread. If it doesn’t, the second high-priority thread must wait for the first thread to terminate (Intelligent Transportation Systems, 2007).

Multi process Programming

Running multiple processes concurrently is called multi process programming. The processes can share data through shared memory, database, memory maps, files, and so on. (mswspt, 2010).

Multithreading

Multithreading is a conceptual programming paradigm where a program (process) is divided into two or more subprograms (processes), which can be implemented at the same time in parallel. (Multiple threads/flows of execution in the same program at the same time).

E.g. one subprogram can display an animation on the screen while another may build the next animation to be displayed. Unlike most other computer languages, Java provides built-in support for multithreaded programming. A multithreaded program contains 2 or more parts that can run concurrently. Each part of such a program is called a thread; each thread defines a separate path of execution. Thus, multithreading is a form of multitasking.

Different from multitasking

Read also  Informatics In Public Health Information Technology Essay

Supported by virtually all modern OS – 2 multitasking types:

processed-based: allows computer to run 2/> programs concurrently

thread-based: a single program can perform 2/> tasks simultaneously

Advantages of Multithreading Over Multi process Programming

A thread is light weight, so many threads can be created to use resources efficiently. The threads are all contained by a process so they can share global data. A blocking demand (request) by one thread will not stop another thread from executing its task. Also, the process will not get context-switched for the reason that a thread is blocked.

The result of multithreading is improved performance, increased throughput, improved responsiveness, the ability to execute tasks repeatedly, improved efficiency, better management of resources, and lowered costs. A thread context-switch is tremendously fast and can be at the kernel central processing unit (CPU) level or in user space.

A process is long-lasting, so it costs more to context-switch a process than a thread. Multithreaded programming is much easier than multiprocess programming, performance is faster, and management of resources is easy. Also, synchronization and shared memory use are more hard with processes than with threads, because threads share memory at the process level and global memory access is easy with threads. (mswspt, 2010).

Reason for Build Multithreading In Products

A multithreading strategy allows a company to offer products that can deliver better performance, which lowers customers’ total cost of ownership (TCO). Such products can take advantage of parallelism in hardware through SMP or CMT to execute many tasks in parallel, which does the following, among other things:

Reduces computation time

Improves performance

Improves responsiveness

Enables better interaction between users and multithreaded applications

Increases efficiency when managing resources

Reduces time to market

Reduces human resources costs

Provides portability

Improves users’ perceptions of the products

Increases competitiveness

Reduces contentions for resources such as OS structures, disk, memory, CPU, and so on (mswspt, 2010).

Techniques used in Multithread

Multitasking

Multitasking is performing two or more tasks at the same time. Nearly all operating systems are capable of multitasking by using one of two multitasking techniques: process-based multitasking and thread-based multitasking (O’Reilly, MA 1997).

Process-based multitasking is executing two programs concurrently. Process is referred as a program by programmers. For that reason, you could say that program-based multitasking is process-based multitasking.

Thread-based multitasking is having a program execute two or more tasks at the same time. For example, a word processing program can verify the spelling of words in a document while you write the document. This is thread-based multitasking.

A simple way to differentiates between process-based multitasking and thread-based multitasking is to think of process-based as working with multiple programs and thread-based as working with parts of one program.

The objective of multitasking is to make use of the idle time of the CPU. Think of the CPU as the engine of a car. The engine keeps running regardless of whether the car is moving. Your objective is to keep your car moving as much as possible so you can get the most miles from a limited of gas. Engine that idles wastes gas.

The same theory applies to the CPU in your computer. You want your CPU cycles to be processing data and instructions instead of waiting for something to process. A CPU cycle is somewhat like your engine running.

CPU idles more than it processes in many desktop computers, but the It may be hard to believe. Let’s assume that you are using a word processor to write a document. The CPU is idle until you enter a character from the keyboard or move the mouse for the most part. Multitasking is intended to use the fraction of a second between strokes to process instructions from either another program or from a different part of the same program.

Making proficient use of the CPU may not be too significant for applications running on a desktop computer because most of us rarely need to run concurrent programs or run parts of the same program at the same time. However, programs that run in a networked environment, such as those that process transactions from many computers, need to make a CPU’s idle time productive.

Synchronization of multithread

Multithreading occurs asynchronously, meaning one thread executes in parallel of the other threads. In this way, threads don’t depend on each other’s execution. In distinction, processes that run synchronously depend on each other. That is, one process waits until the other process terminates before it can execute.

At times the execution of a thread is reliant on the execution of another thread. Let’s assume you have two threads. The first is handles gathering login information, and the other validates a user’s ID and password. The login thread must wait for the validation thread to complete processing before it can inform the user whether or not the login is successful. Therefore, both threads must execute not asynchronously, but synchronously.

Java allows you to synchronize threads by creating a synchronized method. A thread that is within a synchronized method protects any other thread from calling another synchronized method on the same object.

How Multithread works

A thread is part of a program that is running. Thread-based multitasking has several threads running at the same time (that is, multiple parts of a program running concurrently). Each thread is a separate path of execution.

As the meaning of multithreading implies, it is a conceptual programming paradigm where a program (process) is divided into two or more subprograms (processes), and which can be implemented at the same time in parallel. A multithreaded program contains 2 or more parts that can run concurrently. Each part of such a program is called a thread; each thread defines a separate path of execution. A program that contains multiple flows of control is known as multithreading.

As in the case of parking system, there may be a situation where a one car is entering and another is this exiting at same time, which means two tasks are happening at the same time both action are occurring parallel and concurrently and does not depend on one another. That means one is for the entrance and another is for exit. Another situation is when the admin is monitoring the traffic of the area; at least three threads are working simultaneously. One is the one which reading the cars that are entering, another is the one which is running the time and the other is the one which is counting the cars that exited. So admin can adjust either of the thread in other reduce or control the traffic. And also there other thread which storing the Thus, multithreading is a form of multitasking.

Different from multitasking

Supported by virtually all modern OS – 2 multitasking types:

processed-based: allows computer to run 2/> programs concurrently

thread-based: a single program can perform 2/> tasks simultaneously

Threads execute in the same data space. If global variable changes in one thread, all other threads will observe the change.

The ability of a language to support multithreads is referred to as concurrency. The threads in java are subprograms of a main application program and share the same memory space

A multithreaded program enables programmers to do multiple things at one time. They can divide a long program into threads and execute them in parallel. This will improve the speed of our programs.

(Realtime and concurrent, chafter 5. 2010).

Advantages and Disadvantages of a Multithread

Before embarking on a plan to uses these techniques, the Author investigate on it is important and understand it is potential benefits and pitfalls.

Advantages of a Multithread

Improved performance and concurrency

For certain applications, performance and concurrency can be improved by using multithreading. In other applications, performance can be unaltered or even degraded by using multithreading.

Simplified coding of remote procedure calls and conversations

In some applications it is easier to code different remote procedure calls and conversations in separate threads than to manage them from the same thread. (BEA, 2000)

Disadvantages of a Multithreaded

Difficulty of writing code

Multithread application is not easy to write. Only experienced programmers should embark on coding for these types of applications.

Difficulty of debugging

It is much harder to replicate an error in a multithread application than it is to do so in a single-threaded, single-contexted application. As a result, it is more hard and difficult, in the previous case, to identify and verify root causes when errors occur.

Managing concurrency is difficult

The task of running concurrency between threads is difficult and has the possible to introduce new problems into an application.

Difficulty of testing

Testing a multithreaded application is more difficult than testing a single-threaded application because defects are often timing-related and more difficult to reproduce. (BEA, 2000)

Problems with Multithreading

If more than one thread manipulates shared variables or objects at the same time, corruption may result. Variables of instance are shared between threads. The change affects the other threads if one is modified by a thread. Method variables are unique for each thread. Each of the thread has its own copy.

Solution

A way to prevent data from being corrupted by multiple threads is to prevent the interruption of critical regions. Critical regions are places like num=num+10 above, where only one thread should be running at once. Java’s synchronized can be used to ensure that only one thread is in a critical region at once. When the thread enters a synchronized code block, it tries to get a lock on that region. While the thread is in the critical region, no other thread can enter the critical region. If a thread tries to enter and the code is already locked, the thread has to wait for the other thread to leave the critical region. This can be preset by synchronizing the access to num synchronized (this) ensures that only one thread can be in the following code block. The case tells the thread to use the lock for this object (Intelligent Transportation Systems, 2007).

A critical region is used to copy num to temporary storage. The string is then printed using the temporary storage. It would have been possible to synchronize the print line directly, but it would cut performance because the print line does many other things that have nothing to do with referencing num. All the threads waiting to enter the critical region will needlessly wait longer while the print line is executed. Generally, the synchronized blocks should be as small as possible while still protecting the critical region.

Conclusion

In this chapter, the Author understands specific uses of threads that can be expanded to general use. Most threading problems can be solved by using slight variations. If threads need to communicate with each other, care must be taken to avoid data corruption. And it also shows how data corruption and the steps that must be taken to avoid it. Again it illustrates how two threads can be synchronized so that they can do things in the right order. Finally, it shows many of the subtle problems in a multithreaded environment. If threads in an applet compete for common resources, a deadlock can occur unless care is taken to avoid it.

Order Now

Order Now

Type of Paper
Subject
Deadline
Number of Pages
(275 words)