Friday Feb 15, 2008

Snow, Snow and Snow!

There is a Chinese saying, “瑞雪兆丰年”, which means “a snow year, a rich year”. However, in this winter, if we ask a question to a person who lives in China, “What impress you most in this winter?”, I believe most likely the answer is “too much snow”. No doubt, there is a very bad snow disaster in south China in recent months. Because of the heavy snow, a lot of people could not go to hometown for Chinese new year holidays; a lot of towns could not have stable power supply; a lot of people had to stay in cars or trucks for days because the highways were blocked; and, the worst, some people living in villages were facing the risk of starving because they ran out of food and could not be reached by outside world. In the TV news, I saw that soldiers had to drive armored vehicles to carry food to a village. Disaster, a word that seems not that closely related with our daily life, now seems so near with us.

Although I myself am not living in south China and do not experience the heavy snow, I am feeling the disaster though TV programs, newspapers and Internet. Because most of the recent news are about it. I lived in south China in my childhood, so I understand how much troubles the snow disaster would bring to the people living there.

Disasters are horrible, but they can not damage that much if we are prepared against it. Every time I see people struggling in the snow in the TV news, I was always thinking about a question, are there anything we could do to prepare against the disasters, especially in our daily life or work?

Every time after a disaster strike, people will always say: “if we got bla bla prepared, then the damage will be much less than what we got”. While government should do a lot to prepare against disasters, individuals can also do something in our daily life or work. I believe it will help a lot if the huge population would think about it and contribute a bit. I myself thought about it and have some straightforward ideas:

1. Subscribe to weather forecast and be serious to bad weather warnings. If people would cancel their travel plans in the areas covered by snow disaster, then fewer people will be blocked in the railway stations and no one would be treaded to die.

2. Save power in daily life and work. In the snow disaster, we see that a big problem is the lack of coal for power plants. If all of us have good habits to save energy, then, less coal and power are needed, fewer problems we will have. On the other hand, when disasters come, we will have more energy to deal with them.

3. If you are an engineer, you are so lucky that you could contribute more. For example, you can try to develop better technologies for people to do telecommunication. People can then meet their family members over distance as if they were in one room, instead of have to travel in bad weathers.

OK, I have talked a lot about snow. For the other sorts of disasters, they are the similar cases. For example, investigation reports tell that some forest fires were caused by small cigarettes. If all of us would stop smoking, then the risk of having a forest fire would be decreased a lot. Let’s keep the world and ourself clean.

I love snow, because it is white, clean and beautiful. What’s more, I can enjoy skiing in the winter. I hate snow, because it causes traffic problems and too much of it will make a disaster. Fortunately, we can learn to get prepared against it. As long as we are prepared for it, we will just enjoy it.

Thursday Sep 27, 2007

New USB webcams tested on Solaris

I received five Logitech webcams weeks ago. They are all new models, very fancy. I then had a quick test on Solaris Express. Four of them work well with Ekiga application integrated in Solaris, just plug and play. One of them can not work, the reason is that it does not conform to USB video class spec from usb.org, it needs chip specific driver. The other four webcams passed more tests later. I have updated one of my previous blog to add the names of them to a device list which tells all the tested webcams on Solaris video class driver (usbvc(7D)).

 Device Name                          Vendor ID, Product ID

Logitech Quickcam Pro for Notebooks       046d,0991
Logitech Quickcam Deluxe for notebooks    046d,09c1
Logitech Quickcam Communicate Deluxe      046d,0992
Logitech Quickcam Pro 9000                046d,0990

So far, there are about 9 or more webcams are supported by Solaris video class driver (usbvc(7D)). Again, for a full device list, please refer to my updated blog for USB video webcams and applications.

Tuesday Jul 17, 2007

Data Alignment Issue


If a data structure will be used in both a 32bits binary and a 64bits
binary, e.g., an ioctl structure which is passed from a 32bit
application to the 64bit kernel, then we need to consider the code
alignment issue. Because:

  •   The structure size might be different for a same structure.
  •   The offset of each structure member might be different for a same
    structure.

The alignment can be decided by compiler options. The default compiler behavior will conform to the top rule: all structure members must start at its alignment addresses, and, the whole structure should start at the alignment address of its largest member.
For example, uint16_t will always start at even address, uint32_t will always align at 4 bytes boundary, etc. There are also some points as following:

  1.  

    The whole structure's size will be according to the biggest member's
    alignment. e.g., if the biggest member is uint32_t, then the whole
    sizeof(struct) will be divided exactly by 4bytes.

  2.  

    If there are "long", "pointer", or "long double" types in the
    structure
    members, then the alignment in 32bit and 64bit binaries will be
    different. Because they are different length. For example, if there is
    a pointer in a structure, then, in a 32bits binary, it aligns at 4
    bytes
    address; in a 64bits binary, it aligns at 8 bytes address.

  3.  

    The max alignment of 32bits binary is 32bits, The max alignment of
    64bits binary is 64bits. So, if there is a "long long" in a 32bits
    binary, it aligns at 4 bytes address; however, the same type aligns at
    8 bytes address in a 64bits binary.

  4.  

    "enum" type is considered as uint_t.

Code alignment feature can be disabled by setting specific compiler options, such as, gcc -fpack-struct, which will remove the code alignment feature, that is, there are no gaps between structure members.

And "pack" pragma can also do the same job, details refer to the related section of "C User's Guide". Note that the pragma might cause problems on different hardware platforms.

The following table is comparing the data types between 32bits and 64bits binaries.

C Type                      ILP32                LP64
 

char                            8                    8
  short                          16                   16
  int                              32                   32
  long                           32                   64
  long long                   64                   64
  float                           32                   32
  double                       64                   64
  long double               96                   128
  pointer                      32                   64


-----------------------------
An data structure Example:


    typedef enum list {

        a0 = 0,

        a1 = 1,

        a2 = 2,

    } list_t;


    struct align {

        uint16_t a;

        uint8_t  b;

        list_t    list;

        uint8_t    c;  

        uint8_t    d;  

    } sa;


offset_a=fffffd7fffdff954, offset_b=fffffd7fffdff956,
offset_list=fffffd7fffdff958, offset_c=fffffd7fffdff95c,
offset_d=fffffd7fffdff95d, sizeof_allign=12

Saturday Jun 30, 2007

"Real-Time" and Desktop User Experience


There are billions of desktop users in the world, it means a lot to
improve computer system for them. As a desktop user and a software
engineer, I've thought a lot regarding as desktop user experience
recently.  I think there are a lot of relationship between "Real-Time"
and Desktop User Experience.

My Ph.D. thesis is about real-time operating system. From academic
view, in computer science, the term "Real-Time" has an strict
definition, it mainly means, in a real-time system, a compute task must
be completed within the expected time. In practice, especially in the
desktop area, while its academic meaning is sometimes still kept, this
term also means "quick response to user's instructions". Desktop users
always would like their computers behave in a real-time way, for
example, they would like the audio/video player always output smoothly
instead of having pauses; they would like the application window pops
up and is ready for use immediately when double clicked, instead of
having to look at the progress bar growing; they would like the
computer boot/shutdown process to be as short as a snap instead of
minutes; ...

So, we know that one of the main aspects of desktop user experience is
"real-time". To distinguish with other kinds of real-time, I would like
to call it "Desktop Real-Time" here, this kind of real-time is mainly
about desktop user experience.

There are a couple of issues can be discussed regarding as desktop real-time:

- Multi-media applications' performance, such as audio/video play and record.

- Application start-up speed.

- GUI operations, like mouse movement, window switch, window resize/move, etc.

- System boot & shutdown time.

- Switch time between power management levels,  for example, suspend to
disk from full power level, resume to full power from sleep level, etc.

- etc.

All of the above issues impact desktop user experience. Users,
including me, will be very happy if the above issues can be solved.

There are mainly three ways to improve the real-time feature:
- Improve the hardware executing speed, such as CPU speed, I/O speed, etc.
- Improve the application performance by optimizing each of the application code
- Improve the resource management framework to make use of the system
hardwares as reasonable as possible. The word "reasonable" here means,
system should assign the hardware resources to the applications which
impact real-time feature most at the moment. There are several things
need to be done to reach such an aim:

  • Improve the OS scheduling infrastructure, such as processor
    schedulers, application virtualization mechanisms (e.g., zones), etc.
  • Create configuration tools for users to conveniently configure
    the applications that they want them to be real-time. For example, to
    set a high scheduling priority for a most often used application.
  • Pre-load some applications from disk to system memory or some
    kinds of caches. This will impact the real-time feature significantly
    because the disk I/O is usually the bottle neck.
The first two ways are up to the computer hardware vendors and
application vendors. The third way mainly depends on operating system
vendors, sometimes, also depends on infrastructure hardware vendors.
Apparently, people are always trying their best to improve real-time
feature in the first two ways, there are a lot of issues can be
discussed in the detail technologies. I personally am more interested
in the third way, I am now working on it for Solaris OS in my spare
time. Hope there will be any progress soon.

Sunday Jun 24, 2007

USB Documents: for Solaris users and driver developers

I collected some useful links for Solaris USB users and driver developers as following. For ease of use, they are grouped into classes. Most of them are frequently updated and quite up to date. Before I put them here, I sent them to my colleagues, so you can also find them posted on some opensolaris forums by others.

 
USB overview
=================

  1. Solaris USB FAQ
  2. Lists of USB devices verified on Solaris
  3. USB in the future -- Wireless USB technology


Using USB devices on Solaris
=============================

  1. Use USB devices on Solaris 10
  2. Use USB devices on Solaris Express
  3. Use USB printers on Solaris 10
  4. USB Security Script for USB device access control


Develop USB device drivers
===========================

  1. Develop USB drivers on Solaris
  2. USB project page on opensolaris.org
  3. Documents for USB driver development on Solaris


Mail lists for Solaris USB user/developers
============================================

  • usb-help@sun.com
  • driver-usb@opensolaris.org
  • driver-discuss@opensolaris.org
  • wusb-discuss@opensolaris.org

USB webcams and video conferencing on Solaris

OpenSolaris build 56 (released in January, 2007), USB video class
driver usbvc(7D) is integrated into Solaris. That is, if a user plug a
USB webcam that compliant to USB video class spec from usb.org, then
the webcam will plug and play on Solaris. More details see the "Heads-up".

In OpenSolaris build 63 (released in April, 2007), Ekiga video plugin
is also integrated. It is a video conferencing application, supporting
H323 and SIP protocol. Solaris users can enjoy video conference on
Solaris if they have a USB webcam and a audio speaker/microphone.

While I was developing usbvc driver, a JDS team was working on Ekiga
video plugin. There are a lot of cases need be tested for the driver
and Ekiga application. Ekiga is the first user of  the driver,
therefore, several problems are discovered when they run together. We
are lucky that we had a very good communication channel, so all the
bugs/issues were solved in a very efficient way. Before I integrate the
driver to Solaris source tree, Ekiga's video plugin can already work
very well on usbvc driver.

The most frequently asked question is, which webcams can be supported
by usbvc driver? Theoretically, all USB webcams that compliant to USB
video class spec can be supported. In practice, the following webcams
are tested, their video capture functions work well. Users are
encouraged to report problems if they have chances to use any other
webcams that compliant to the spec. The following list is last updated at Nov. 26, 2007. Please note that some devices have the same names but different IDs.


    Device Name                          Vendor ID, Product ID

Logitech Quickcam Pro 5000                046d,08c5
Logitech Quickcam Pro 5000                046d,08ce
Logitech Quickcam Fusion                  046d,08ca
Logitech Quickcam Orbit MP                046d,08cc
Logitech Quickcam Pro for Notebooks       046d,08cb
Logitech Quickcam Pro for Notebooks       046d,0991
Logitech Quickcam Ultra Vision            046d,08c9
Logitech Quickcam Deluxe for notebooks    046d,09c1
Logitech Quickcam Communicate Deluxe      046d,0992
Logitech Quickcam Pro 9000                046d,0990


The following ones are reported to work. Thanks people for reporting this. Last updated at Apr. 9, 2008


Logitech Quickcam Pro for Notebooks    046d,8c3
Logitech QuickCam Sphere AF               046d,994
HP         Deluxe DC-8872


Issues can be reported to driver-discuss@opensolaris.org or driver-usb@opensolaris.org

Saturday Jun 23, 2007

Who am I?

Last week, I am asked to write a self description using third person's tone for a web page. At first, I felt a little unaccustomed, but then I found it is interesting. Just like watching yourself in the mirror, you feel you are looking at yourself outside of you.

The following are what I wrote for myself. ;-)

Colin Zou is working in Solaris development team. He works on
Solaris USB device drivers and framework since the year 2003. In the
last four years, he integrated  several USB device drivers to Solaris,
such as USB video class driver for webcams, Keyspan USB-to-Serial
driver, etc. He fixed dozens of bugs, covering USB framework to various
USB drivers.

As one of the pioneers in USB China team, Colin also works
as a mentor in the team. He interviewed nearly a hundred of developer
candidates, and mentored a couple of new hires and interns. In recent
two years, he works as USB team lead and the team is responsible for
the whole Solaris USB software stack. Colin is now working on UWB &
Wireless USB support project. Stay tuned, when the project is released,
Solaris users can enjoy the new technology. :-)

Colin has acquired the Ph.D. degree from Institute of Software, Chinese Academy of Sciences.

Highlights:

Engaged in Solaris development and innovation, working on high priority
projects and customer issues. He is one of the leaders of device driver
community on OpenSolaris.org. Any questions about Solaris USB? Ask
Colin. He will answer your questions directly or point you to the right
team members. Colin participated in the translation work of "Solaris
Internals" book (2nd Edition). He contributed two and a half chapters
to the Chinese version book. To know more about Colin Zou, just Google
his name or take a look at the following links, including profile page,
blog, and project pages created by him.

Emails: 

Colin.Zou@sun.com
Colin.Zou@gmail.com 

Finally, we get it published: Chinese version book of "Solaris Internals, 2nd Edition"

Since the year 2005, before the English version "Solaris Internals, 2nd Edition" formally published, a group of Sun engineers in ERI
site (located in Beijing, China) started to translate the book into Chinese. Fortunately, I am one of them. We work on the translation in
weekends, vacations, and even holidays. I myself spent three "golden weeks" and some vacation days working on the translation, contributed two and
a half chapters to the Chinese version book. Recently, in June, 2007, the Chinese version book is published. It looks fabulous! When I see it
at the first glance, I felt that I was looking at my baby in expectation for a long time.

This book can be easily found at a popular book store in China, there are already some comments about it from the readers.

http://www.china-pub.com/computers/common/info.asp?id=34295

I heard that some Chinese universities are going to use it as a reference book for their OS courses. I will be happy if the book will
have a mass of readers.

About

Colin Zou is a software engineer enjoying improving operating systems. Besides sitting at a computer all day like a dull boy, he also likes hiking and the activities on the beach.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today