怎样让 Windows 跑得比 Linux 快?

看到这个标题我就知道一定是一篇逗乐的,打开一看,果然。

还蛮有道理的。? LOL

阅读全文 »

Sun 的多线程战略

这是一篇2007年的文章,然而,时过境迁,里面的好多内容恐怕需要修改了。

Multithreading Strategies With Sun Products and Technologies

By Nagendra Nagarajayya, June 2007

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:

* 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

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 1×1 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 malloc, atomic operations, and automatic parallelization technologies. (Note: While the IDE is based on open source NetBeans, the compilers and libraries are free, but not open source.)

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:

* UltraSPARC T1 processor-based Sun Fire T1000 and T2000 systems; Netra CP3060 UltraSPARC T1 ATCA Blade, an enterprise blade; plus the Netra T2000 NEBS system

* UltraSPARC IV+ processor-based systems, such as the Sun Fire V490, Sun Fire E4900, Sun Fire E6900, and Sun Fire E25K servers

* Advanced Product Line (APL) processor-based systems

* x86-processor based systems, such as the Sun Fire X2200 server, Sun Fire X4200 server, and so on

* The new UltraSPARC T2 processor-based systems and “Rock” processor-based systems ([9], [10])

Software:

* The Solaris Operating System

* Java technology, all Java technology-based products, Sun Java Enterprise System, and so on

* Sun Java System Messaging Server

* Sun Java System Identity Manager

* N1 Grid Software

* Sun Studio compilers [11]

* StarOffice software

* NetBeans IDE [12]

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 1×1 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:

* OpenSolaris software with a Common Development and Distribution License (CDDL)

* OpenJDK (Java language platform) software with a General Public License (GPL)

* Java ME (Java Mobile Edition) software with a GPL

* OpenSPARC processor (UltraSPARC T1 processor) with a GPL

* GlassFish (Sun Java Application Server) with a CDDL

* NetBeans IDE with a CDDL

* OpenOffice [19] with a Lesser General Public License (LGPL)

* Grid Engine [20]

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:

* Developers can make use of free, open source Java technology to develop their applications, which can then run not only on Sun systems and the Solaris OS but also on other platforms, such as Windows, Linux, IBM, HP, and so on.

* Developers can develop their applications with the free, open source-based NetBeans IDE. They can also make use of Sun Studio compilers, debugger, and tools, such as the static lock analyzer, the optimizer, the profiler, the performance boosting libraries, automatic parallelization, openMP, and so on, to write applications in C, C++, or Fortran.

* Developers can access the Sun developer web site, which provides how-to information, performance tuning information, white papers, case studies, and tutorials on many subjects.

* Sun offers partners the Partner Advantage program, which can be used to tune products in Sun labs by working with the ISV Engineering group and product engineers. Products can be performance tuned, sized, benchmarked, and so on.

* Developers interested in grid or Software as a Service (SaaS) technologies can make use of the Sun Grid to run their high computation programs.

* Developers interested in highly parallel, multithreaded packet processing applications on bare silicon can use the Netra Data Plane Software Suite for fast-path network processing.

My Suggestions

Here are some additional things I recommend:

* Applications and servers: Use the Java programming language for standalone applications.

* Web-based applications: Use Java Platform, Enterprise Edition (Java EE) technologies, if possible, such as thin client architectures, JavaServer Pages, JavaServer Faces, and frameworks such as Spring.

* OS: Use the Solaris 10 OS (for x86 or SPARC platforms), which is free, open source, fast, and scales up to 128 cores.

* Sun Fire T2000 server: Use for web-based applications, not for computation intensive applications.

* UltraSPARC IV+ processor-based systems: Use for computation intensive and high-performance systems.

* UltraSPARC T2 processor-based systems: Use for web-based applications, computation intensive applications, network applications, packet processing applications, and database applications on low to midrange systems.

* Rock processor-based and APL processor-based systems: Use for computation-intensive, database and high-performance systems (midrange-high-end).

* Systems based on x86 AMD Opteron and Intel processors: Use for low-cost, web-based, computation intensive applications and low-end to midrange databases.

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

ZFS 的 License

在这篇文章中,作者提到了 ZFS? 的许可问题,他是这样写的:

  • ZFS is open source. ?Oracle can no more pull back code from ZFS than Nexenta and our founders can pull back the iSCSI code we developed years ago and contributed to the Linux kernel.
  • The case is bi-directional. ?NetApp is being threatened legally by Oracle.
  • If you are one of the 78% percent of enterprises that support OpenSource (see my related?blog on a recent Accenture survey), now is the time to stop buying solutions from legacy vendors that resort to lawsuits.

回过头来看, Apple 放弃 ZFS 是明智的。

Open Solaris 死了!

看完这篇文章后面的评论,才比较清楚的了解了 OpenSolaris? 的许可问题,原来是彻头彻尾的反 GNU 的。

如果说要停止开发的话,也可以理解,开源社区的人们应该额手相庆了。这个评论是这样写的:

阅读全文 »

Operation System or Operating system ?

新来的实习生,把 Operating System 写成了 Operation System ,怎么看都觉得有点别扭。他说是字典上查询来的,绝对不会有错。刚才去了一把? Wikipedia ,搜索 Operation System 自动定向到 Operating System 了。

或许这个实习生没有说错,但是作为计算机应用专业的硕士,这个词应该是放在口头上的,就像自己写一个不常用的中文字,看来看去不顺眼,估计是有那里写错,但是找不出错的地方。

这位小兄弟,还把 Leadership 写成了 leadship 。? :-(

数据中心设计的五大趋势

低碳,绿色的数据中心必将是趋势。这篇文章介绍了数据中心的五大趋势,对于企业的 IT 运营和 IT 服务提供商都具有借鉴价值。

1. Energy costs outweigh capital costs

2. Modularity matters

3. Cooling is key

4. Virtualized everything

5. Self-diagnosing data centers

云计算改变世界最早的报纸发行商

看完这篇报道,会对 “IT Doesn’t Matter” 有更加深的感触。 每一个 IT 人都应该很清楚自己的角色。当 CEO? 削减成本的大斧砍下的时候,由规模化提供服务的 SaaS 模式必将盛行。

从以前的 ASP (Application Service Provider) 到 SaaS,标准化和规模经济导致的低成本,将是云计算大展前途的地方。

IT 外包的七个注意点

在 CIO 网站上看到这篇文章,大概的翻译一下:

阅读全文 »

skype on iPad

不错,可以工作的。

ZT: New Features In Bash Version 4.x – Part 1

Source: http://lcorg.blogspot.com/2010/04/new-features-in-bash-version-4x-part-1.html

阅读全文 »