Process Management Impact on the Programming Languages

Abstract

 A program in execution is defined as a process, for example a word-processing program being running by an end-user; is a process. Such a process required specific resources (i.e. memory, CPU time, files, and I/O devices) to accomplish the required tasks. A process is a unit of work within a system, and such system usually contains a collection of processes that can be an operating system processes, and user processes. All processes within a single processor or multi-core processor can be executed concurrently by multiplexing on a single or multi-core CPU. With today’s technologies; modern operating systems provide the capabilities for a process to contain multiple threads of control, where a thread is a basic unit of CPU utilization (Silberschatz and Galvin, 2009).

Silberschatz and Galvin (2009) explained that with such capabilities available in the modern computing system; most of the modern languages have a support of the multi-threading programming that can manage process via a thread library APIs. The threads library provides the programmers with APIs for creating, and managing process’s threads. Many of the computer languages provide one or both of the following approaches:

 

  • Providing threads library in the user space without the kernel support where the system calls are not required.
  • Providing a kernel-level threads library where it’s supported directly by the operating system.

By invoking any function in such library; a system call to the kernel will be called accordingly. For example; the Java thread API allows threads to be created, and managed directly in Java programs. However, since the JVM is running on top of the hosting operating system, the Java thread API is implemented using the thread library available on the host system. That said ; the Java thread API is implemented using the Win32 APIs when the Java application runs under Windows, and implementing the UNIX and Linux threads APIs library (Pthreads) when the application is running on Linux or UNIX (Silberschatz and Galvin, 2009).

Programming History with Process Management

Titus (2004) explained that by implementing the multithreading APIs with user’s application; it enables such application to respond to user’s events while accessing other resources (such as network resources or file systems) at the same time. For instance; in Visual Basic 6, Microsoft didn’t give too much power to the programmers to handle process threads, however; Visual Basic would implement threading behind the scenes, and it would execute the appropriate handling code within a specific threading model. With visual C++; more power was given to the computer programmers to have a full access to the Windows threading, and process model through the APIs, however programmers had to learn a complex tricks to ensure that the threads were kept under control.

In .Net framework; Microsoft created a model that can be between the Visual Basic and C++ environment. In this new environment the full power given to the programmers to access a full powerful threading model that allows the programmers to control what runs in a thread (any process) and let the Common Language Runtime (CLR) to take responsibility for memory management to clean up threads.

All programs and in turn processes execute in threads, for example Windows forms applications use event-loop threads to handle user interface events, where separate forms execute on separate threads. Also, ASP.Net pages execute inside multi-threaded environment within IIS (Internet Information Server), and separate requests for the same page will be executed on different threads. That said; by implementing the process management methodology via multithreading, programmers can create an application that never have to wait while processing some data, and the availability of the application can be instant to the users’ events (Titus, 2004). 

During an application design process; whenever there is an operation that would normally block the application (such as file system operation); such operation will be a good candidate for multithreading to improve the application responsiveness to users requests.

Process Management in .Net Framework

Titus (2004) explained that process management through the multithreading is supported in the .Net Framework and therefore it is available in all .Net languages including C# and VB.Net. Building multithreaded application with these languages requires resources, and the number of threads that can be used is limited by the amount of memory. Additionally, application can’t be built on assumption that the application will have enough memory. Also, with building such applications an assumption can’t be made that the applications processes are the only processes that will spawning threads and consuming system resources. System configuration will be always the main factor that will dictate the number of threads that can be implemented within any application.  Too many threads will add overhead on the resources, and the operating system on any computing power.

Managing processes via multithreading capabilities supported by any programming language is a great opportunity for programmers to build robust application. A good practice of the multithreading programming is to allow the application to run its lengthy processes in the background threads while still keeping its user interface active and usable. Another circumstance could be when the application has to run a process that need access to remote resources such as database process, or network file, in this case spawning a new thread will increase the performance of such application (Titus, 2004).

Problem with Threading

Titus (2004) also explained that if every process within an application is running exclusively without being dependent on any other process, then multithreading will be an easy task to be achieved. However, in reality each process needs to read or write in memory used by other processes and this is where the problems start. The problem with threads is for the programmer to be able to control one thread access a shard piece of memory while another thread can have the same opportunity to access the code, and manipulate the same data shred by different threads. To implement a safety of a thread in a language such as C# or VB.Net particular part of memory need to be locked (i.e. instant of an object) to prevent other thread from accessing the same object memory until such thread is done using the object.

Conclusion

James (2006) stated that process management and multithreading is not a science that has fast rules to guide programmers and with Hyper-threading processors and multi-core processors, the subject of the process management via multithreading becomes critical subject to deal with. It is important with new architecture that programmers must use the right multithreading techniques in the right places within the application. Also, users preferred application implementing a multithreading technique than the one that running with single thread; since the performance and the responsiveness of such application is in high demand among users.

Seguin(2009) also stated with a multi-core processors architecture that is provided in modern computing systems; applications developers must adapt such realities by leveraging the multithreading techniques, and concepts as part of their programming skills. Modern operating systems have the capabilities of multithreaded performance by time-slicing other threads. However, the dangerous in that with multi-core processors systems comes from the ability of such systems to run multithreads per core processor which requires sharing the same memory space with all other threads for the same process.

There are many asynchronous methods implemented within the .Net Framework that allow increasing the capabilities of managing processes and their threads. Finally, developers can no longer rely on increasing the clock speed to speed up the performance of a single threaded process within any application; instead they need to gain new skills to learn how to design application that can take advantage of the modern multi-core processors and multithreaded environment.

References

James, J. (2006) Multithreading Tutorial, Part One: Introduction [Online]. Available from: http://blogs.techrepublic.com.com/programming-and-development/?p=79 (Accessed: 20 August 2010).

Seguin, K. (2009) Multithreading Programming Primer-Part 1 [Online]. Available from: http://dotnetslackers.com/articles/net/Multithreading-Programming-Primer-Part1.aspx (Accessed: 20 August 2010).

Silberschatz, A. & Galvin, P. (2009) Operating System Concepts. 8th ed. NJ: John Wiley & Sons, Inc.

Titus, T. (2004) C# Threading Handbook. 2nd ed.USA: APress.

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: