Introduction
Multithreading increases the efficiency of a resource by running multiple tasks at the same time. Multithreading techniques can be implemented in software (at the operating system level or as a user application library) and in hardware (at the processor level). This article discusses the advantages of multithreading and the multithreading offerings available from Sun. Contents
The following topics are covered in this article:
What Is Multithreading?
Multithreading is a technique that allows a program or a process to do many tasks concurrently (at the same time and parallel) [1]. Multithreading allows a process to run tasks in parallel on a symmetric multiprocessing (SMP) system or a chip multithreading [2] (CMT) system, allowing the process to scale linearly with the number of cores or processors, which improves performance, increases efficiency, and increases throughput. What Are Processes and Threads?
A process is a heavyweight entity that lives inside the kernel. It consists of the address space, registers, stack, data, memory maps, virtual memory, user IDs, file descriptors, kernel states, and so on. 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 share a process, that is, they share the address space, user IDs, virtual memory, file descriptors, and so on. The threads within a process share data, and they can see each other. What Is Multiprocess Programming?
Running multiple processes concurrently is called multiprocess programming. The processes can share data through shared memory, files, database, memory maps, and so on. What Are the Advantages of Multithreading Over Multiprocess Programming?
A thread is lightweight, so many threads can be created to use resources efficiently. The threads are all within a process so they can share global data. A blocking request by one thread will not stop another thread from executing its task. Also, the process will not get context-switched because a thread is blocked. The result of multithreading is increased performance, increased throughput, increased responsiveness, the ability to execute tasks repeatedly, increased efficiency, better management of resources, and lowered costs. A thread context-switch is extremely fast and can be in user space or at the kernel central processing unit (CPU) level. A process is heavyweight, so it costs more to context-switch a process than a thread. Multiprocess programming is much more difficult than multithreaded programming, performance is slower, and management of resources is difficult. Also, synchronization and shared memory use are more difficult with processes than with threads, because threads share memory at the process level and global memory access is easy with threads. Why Do Companies Build Multithreading Into Their 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:
What Competitive Advantages Can Sun's Multithreading Products Provide to Customers?
Sun is considered a leader in multithreaded technology, including CMT, and Sun was one of the first companies to offer SMP-based systems. Sun's UltraSPARC T1 processor [3] can handle eight different tasks from eight different threads simultaneously in a single clock cycle. The UltraSPARC T1 processor itself is multithreaded in hardware to improve the efficiency, and it has four hardware threads per core. Sun's new UltraSPARC T2 processor [4] has 16 pipelines with 4 vertical threads each and can handle 16 tasks simultaneously, improving core efficiency and increasing the throughput almost 3x compared to the T1 processor. The UltraSPARC IV+ is a multicore processor and can handle two different tasks from two different threads simultaneously. The APL [5] processor has four cores and two hardware threads per core. The upcoming "Rock" [6] processor will have 16 cores with two hardware threads per core. Sun's multithreaded strategy is not limited to processors. The Solaris OS has a multithreaded kernel, and it has been multithreaded since the Solaris 2.0 OS release. Software programs running on the Solaris OS can be single threaded or multithreaded. The Solaris OS has a 1x1 threading model and scales up to 128 cores with the Sun Fire E25K server (Sun's largest system).
Sun also provides free, open source tools for developing multithreaded applications on the
Solaris OS. The tools range from integrated development environments (IDEs) to compilers,
optimized libraries, multithreaded In addition, Sun invented the Java platform, and the Java language provides multithreading support as part of the language, not as another library. Java applications scale from the smallest devices, such as Java Card and Java Ring, to mobile phones, to applications servers running on the Sun Fire E25K server. Sun introduced throughput computing to reduce the cost and complexity of computing. In throughput computing, the idea is to maximize workload throughput in a known amount of time through CMT technology. CMT technology can process multiple tasks from multiple software threads simultaneously, which improves throughput compared to single threaded processing on single threaded processors. Improved throughput reduces the cost of computing because fewer systems are needed to do the same amount of work. Fewer systems mean reductions in system management, costs, and power consumption, all of which are beneficial as companies strive to improve their profits by reducing capital expenditures and operating expenditures. Using Sun products, customers can gain a competitive advantage because they can provide their own end-to-end solutions or use end-to-end solutions from Sun. For increased performance, customer applications can scale from a single processor to 128 cores. In addition, the Solaris OS is open source [7], so there are no license fees for customers. (Note: There are no license fees for software. Support and services might not be free.) Sun has also open sourced the application server and in fact offers the Sun Java Enterprise System at a per employee plan, reducing the cost of ownership of enterprise software. The Sun Java Enterprise System provides servers and applications that can be used to develop, run, and manage applications on devices from mobile devices to large Sun Fire E25K systems. These applications include application servers, portal servers, web servers, enterprise service buses, identity management, content management, and so on. In addition, Sun has partnered with Oracle and other database (DB) vendors to offer savings for databases running on Sun products. Sun offers free, open source databases (such as MySQL, PostgreSQL [8], and Enterprise DB) with its systems, and Sun supports PostgreSQL. What Sun Products Have Multithreading Capability?
Sun offers the following hardware and software with multithreading capability: Hardware:
Software:
What Are the Innovative Features of Sun's Hardware and Software?
From thin clients to big servers such as the Sun Fire E25K server, many Sun products are SMP-based or CMT-based. Sun's software products are open source (free or can be licensed), offering cost savings to an enterprise or company. The Solaris OS (which runs on SPARC and x86 platforms) can scale from a desktop to 128 cores. The Solaris OS is open source and multithreaded at the kernel level. It was the one of the first forms of UNIX to offer this feature, a preemptible [13], multithreaded kernel. The OS offers a 1x1 threading model, and offers optimized threading primitives and a POSIX standards interface. Sun offers a binary compatibility guarantee that products compiled on the Solaris OS run without any changes from desktops to the E25K server. The Solaris OS offers an optimized Java Virtual Machine (JVM) to run Java applications. The JVM leverages Solaris threads to improve scalability and can scale up to 128 cores. The Solaris platform also offers free optimizing compilers, IDE to develop and debug multi-threaded applications. It also offers tools like lock-lint, data-race detection tools, performance analyzers, profilers, OpenMP [14], Sun Message Passing Interface (MPI) [15], high-performance computing (HPC) features, grid computing [16], and so on. What Is Sun's Open Source Strategy?
Many Sun software products are free or they can be licensed [17]. Sun has open sourced the Solaris OS as OpenSolaris, the Java language platform as OpenJDK, and the Sun Java Application Server as GlassFish [18]. The new UltraSPARC T1 processor is also open source. The following are some of the Sun open source products and their licensing arrangements:
Sun also offers Sun Java Enterprise System on a "per employee" plan, reducing the cost of ownership for enterprise software. Sun also makes available and supports open source products such as Apache, PHP, GNU compilers, and so on. How Can Application Developers Take Advantage of Sun's Multithreaded Products?
Sun products are multithreaded from hardware to software. Developers can make use of multithreaded hardware and software products and the open source Solaris OS to test their multithreaded products for scalability on the CMT systems. Here are some ways in which developers can leverage Sun's multithreaded hardware and software products:
My Suggestions
Here are some additional things I recommend:
Note: You can send me an email to get more information. Acknowledgements
I would like to thank ISV Engineering, specifically Jim Parkinson, Dan Powers, and Mayank Srivastava, for supporting me in my presentation on Sun multithreading strategies. I wish to thank James Baty and Jeremy Barnish for their help. I would also like to thank Morgan Herrington for reviewing the contents, which increased the readability and accuracy of this article, Christophe Ebro for reviewing and providing very valuable feedback, and Tai-Wei (David) Lin for his suggestions. And thanks to the team at developers.sun.com. References
Note: For definitions of terms used in this article, please refer to Wikipedia or the Glossary at the end of Reference #2 above. | ||||||||||||||||||||||
|
| ||||||||||||