V3) X-Windows(Client/Server
Total Page:16
File Type:pdf, Size:1020Kb
CS4CC3 / CS6CC3 Advanced Operating Systems Laboratory 1 (v3) X-Windows(Client/Server) LAB to be done individually File:4cc04lb1.doc Date:27sep04/wfsp Revision Level:3.0 2004/2005 CS 4CC3/6CC3 -- Laboratory 1 page 1-2 INTRODUCTION This laboratory will introduce you to the X WINDOW SYSTEM. You will explore the features and capabilities of the X Window System by examining the components offered. The main goal of this laboratory will be to allow you to become familiar with the X Window System and see the way in which programming is handled in a windowing environment. Some of the later labs in this course require the operation and an understanding of the X-window system. Using the X Window System is simply learning how to manipulate windows, icons, and applications will be the main emphasis. In addition to becoming familiar with the windowing system you will be asked to interpret differences in execution time between a host machine and a remote machine using particular benchmark tests. The appendix illustrates the development side of the X Window System. You will be able to inspect some working applications and determine how they work. The difference between raw Xprogramming in C and that done with the X toolkit is quite striking and provided for your information only. SYSTEM OVERVIEW The X Window System is described as a "software environment for engineering workstations."1 Project Athena and the Laboratory for Computer Science, two organizations at the Massachusetts Institute of Technology responsible for developing and using large quantities of workstation application programs, realized that the reprogramming of applications for different types of workstations was wasting large amounts of time and resources. In order to alter this inconvenience, they introduced a common workstation interface. This system was developed at the Massachusetts Institute of Technology (M.I.T.) in the hopes that goals could be reached in the areas of network- transparency, vendor-independence, and portability. Network-transparency allows an application running on a remote CPU to be connected to a workstation and use that workstation for input and output purposes. X applications are portable which means that as long as the application can create a connection to a workstation it can use all of the capabilities of that workstation regardless of the model or vendor provided that the X network protocol is supported. This standard environment for applications, called the X Window System, has grown to be quite popular and there are many components to the system, which need to be understood before programming can be attempted. The X Window Setting The environment of the X Window System is made up of several important entities. The entire system is built upon the Base Window System, which uses the X Network Protocol. This Protocol is the only way through which applications can interface with the Base Window System. To hide some of the complexities of the X Network Protocol an X Toolkit is often used. Figure 1 shows the different 1 Jones, Oliver, Introduction to the X Window System, Prentice-Hall, Englewood Cliffs, NJ, 1989, pp. 2. 2004/2005 CS 4CC3/6CC3 -- Laboratory 1 page 1-3 layers, which constitute the make up of the X Window System. The Base Window System is the lowest layer upon which all other components are added. Applications do not typically access the Base Window System directly. Instead, they use the Xlib; a basic C language routine library. The remaining piece of the puzzle, the window manager, can be seen on the left side of the diagram. It is treated as an application by the X Window system and it's purpose is to monitor window activities. Figure 1: Software components of the X-system. Client-Server Relationship and the X Network Protocol The X Window System is based on the client-server model. The server is the program which is resident in each particular workstation; while applications make up the client portion of this relationship. Messages, which flow between these two entities, are the basic means of communication in this type of model. The X Network Protocol determines the make-up and interpretation of the messages being transferred. In order for this model to take place, a connection must first be made between the client and the server. The application is responsible for making this connection to the server. Once a connection has been established, the transfer of messages can begin using the X Network Protocol. 2004/2005 CS 4CC3/6CC3 -- Laboratory 1 page 1-4 PART I Introduction The purpose of this part of the laboratory is to introduce you to the X Window System as a beginner. You will login to X Windows on one of the Suns and explore how some of the system features work. You will be introduced to windows, X Window applications, menus, and pointer use within windows. Throughout this laboratory it is important to remember that the X Window System is, from a user point of view, relatively easy to use but has a much more complex inner-working which is hidden from view. After reading the preceding System Overview section and the accompanying appendix answer the following questions about the X Window System and include your answers as part of the lab report submitted seven days after the lab completion. 1. What are the four types of packets or messages used in the client-server relationship and give an example of each? 2. Define the following: window, window manager, X Toolkit, Xlib, pointer, X Network Protocol. 3. Explain briefly the diagram presented in the System Overview section. Figure 2: The famous X-Window screen. Note: your screen may differ slightly depending on which window manager has been selcted as the default for the display server in use. 2004/2005 CS 4CC3/6CC3 -- Laboratory 1 page 1-5 Logging In You should sit down in front of a Sun workstation console in ITC-235 or ITC-236*•. A login prompt should appear when you hit the ENTER key. It should look similar to the following although there are several names, which could precede login (i.e. wolf<n> or fox<n>, etc.). Common Desktop Environment Server login : Use your usual login account name and password as noted above, as in wolf2 login : xxxxxxx and respond to the password prompt by typing Password : yyyyyy This should result in a successful login. If this is not the case, ask Mr. Robert Li (RL) or Mr. Derek Lipiec (DL) of the Departmental technical staff (ITC-242) for assistance. Once logged in you may wish to change the default password using the passwd command. You will know that you have entered X Windows when you see some or all of the following: a clock, one or two windows, and an X that you can move using the pointer. See figure 2-2. If you do not reach this stage within a few minutes ask either RL or DL for assistance. Enter your name and password, and figure out which environment you are using. Older machines often default to twm or olwm. Linux based machines, more common at home, will often supply KDE or Gnome. Sun machines often use CDE. The important thing to realize is that no matter which environment you are using, you are still running X. Mouse Movement One of the most important aspects of any windowing system is the pointer device. The pointer is controlled by the mouse normally attached to the right-hand side of your keyboard. Place this on top of the square pad and move it around, watching the screen as you do. You should find that an X is moving within the screen. NOTE: depending on which display server is executing and its selected window manager, some of these mouse movement questions are not applicable. Do your best to see how the behaviour and mouse movements are correlated. • For users already familiar with X-windows, you may perform these operations from home using either a Linux workstation or a MS Windows/Apple OS appropriately equipped with an X-Windows display server software system which converts the PC into a X display server station. Usually a standard login is done from home to the CAS machine designated as the client application system using secure shell (remote login system – do not use “telnet”, “rlogin” or other unsecure method for CAS machine access) which has been previously set up to handle X-tunnelling. The recent VPN (virtual private network) interconnection system from CAS made to access on-campus machines can also be utilized. 2004/2005 CS 4CC3/6CC3 -- Laboratory 1 page 1-6 What happens when you move the pointer into one of the windows on the screen? To enter commands in a particular window the pointer must be in the window. This will cause the cursor at the prompt to become highlighted. Now, move the pointer into the action bar of the same window. The action bar is the top bar of the window which has the name of the window on the right hand side and a small box with two arrows pointing up and down on the right. What happens when you move the pointer here? Are you still able to enter commands with the pointer in this location? Look at the mouse and you should notice that there are three buttons present. Try pressing down one of the mouse buttons while the pointer is in the action bar and holding it down to see what each does. When you press and hold the left mouse button while in the action bar and move your mouse at the same time what happens? Are there any restrictions to what you can do? Explain what the other two mouse buttons do in this instance.