Friday, August 03, 2007

Xfig (with Latex commands) to EPS



This tutorial will help in creating .eps files from .fig files that have Latex commands in them. This is especially usefull for creating figures containing mathematical formulas, for Latex documents. The procedure is outlined below.
  1. The first step is to obviously create the figure using Xfig. However, special care needs to be taken while adding mathemateical formulas and Latex specific text in the figure. Say you want to add "log216" to your figure. Write it in Xfig just as you would in a Latex document i.e.

$log_{2}16$
  1. We will now need to edit the properties of this text by bringing up the "Edit Panel". For the property _Special Flag_, select _Special_ from the drop down box.
  1. Save the figure as a .fig file, say example.fig. Export the figure in "Combined PS/LaTeX (both parts)" format. This will create example.pstex and example.pstex_t files in your working directory.
  1. One has 2 options now - either include the example.pstex_t file directly in the Latex document or create a example.eps file that will be included in the Latex document. For the first case, include the following code in your Latex doc
    ument:

\begin{figure}[htbp]
\begin{center}
\input{example.pstex_t}
\caption{Figure with Latex formula in it.}
\end{center}
\end{figure}

  1. For the second case, create a .tex file, say figure.tex, with the following commands in it:



\documentclass{article}
\usepackage{epsfig}
\usepackage{color}
\setlength{\textwidth}{100cm}
\setlength{\textheight}{100cm}


\begin{document}
\pagestyle{empty}
\begin{center}
\input{example.pstex_t}
\end{center}
\end{document}


Compile this file using the command:


latex figure.tex


Now create the .eps file using the command:

dvips figure.dvi -E -o example.eps

You can now include the .eps file into your Latex document.


Tuesday, October 03, 2006

TODO for the next month

Just had a meeting with my advisor after a very long time. Below is a list of things we discussed about and the work that needs to be done. I am listing it here as I often tend to forget stuff immediately after the meeting.
  • Have to write 2 papers. The first one will be for Sigmetrics 2007 in which we will concentrate on the experiments conducted for the wireless environment. The abstract for this conference is due on Oct. 27th and the full paper on Nov. 3rd. The set of wireless experiments are listed in the TOC of the thesis.

    The other paper will be for Networking 2007 in which we will concentrate on the experiments for resource utilization of a HB under multiple flows. In the setup, there will be n number of flows passing through a bottleneck HB. The graphs will be for Throughput (packets/sec) vs CPU Utilization. The graph should be a linear curve which will (intiution says) top off at a certain point. Compare this with the graph of Number of Flows vs CPU Utilization. The Full paper is due by Oct. 30th. (Seems a tough deadline to meet especially with the Sigmetrics one in parallel)

  • The other most interesting part we discussed was about the alternate congestion control mechanism in the HB. We discussed about marking the packets with increasing probability as the resource utilization within the HB increases. There are 2 methods of marking - Explicit Marking and Minimal Marking.

    Explicit marking makes use of at least 2 bits. One bit is used to indicate that the packet is marked and the remaining are used to provide additional information. This information can be, but it not limited to, what should be the new cwd of the sender, by how much should the sender reduce the window etc.

    Minimal marking makes use of only 1 bit which indicates whether the packet is marked or not. We can change the values of _alpha_ and _beta_ to get some interesting results. See the notes.
Some issues concering marking of packets.

Lets assume that the HB is configured to mark packtes with probability of 1 once the resource utilization is about to reach a threshold. It will continue to mark packet till it receives an acknowledgement of the markings OR when it sees that the sender did reduce the window. However this change will be visible only after 1 RTT. If the traffic is intense, then the sender might reduce the window beyond what is required. Hence it is not a good idea to mark all packets.

A HB may be configured to mark a packet once per RTT. Similar to ECN. In this case there will too few a markings. In case of of intense traffic flow, this is not good as the flow will go into error recovery almost certainly.

Hence we decide to mark the packet with increasing probability as the resource utilization of the HB increases. Something imilar to what RED does.

Saturday, September 09, 2006

Trip to Paris (continued)

So, continuing with the details of my trip to Paris.

I reached Paris rather late in the evening. After freshning up, relaxed in the hotel lobby. I had one day to see Paris, the most romantic city in the world, all alone. I started my day rather late and by the time I was in Louvre it was late afternoon.


Lovre, the home to Mona Lisa, is a beautifull blend of ancient and mordern art. The main enterance for the Louvre is through a magnificant glass pyramid which is surrounded by ancient buildings.


Although, I am not big into museums and the sorts, this one really impressed me. It had these huge paintings which covered an entire wall. Very colorful and, I would say, very well maintained. And yes, I did go and see _the_ Mona Lisa. I wanted to see what the fuss is all about. And after seeing it, I still wonder what the fuss is all about. Its rather small as compared to rest of the art work in there. But then I don't know much about art anyways.


It was evening by the time I got out of the Louvre. Figured out the next best thing to visit would be the Eiffel Tower. So I started my walk towards it. Here are some pictures that I took while walking to the tower.




There was just too many people out there. Here it is in its full glory (well almost).






Feeling content that I saw the two best things of Paris (at least that's what I think), I left for home the next morning. And it was different this time, very different. I was happy, a feeling that I had not felt in a long time.

To be continued....



Tuesday, August 01, 2006

Making WUSB54G work with FC-5

Its always a pain in the *** to get wireless working in Linux systems. Though obviously its getting easier by the day. Follow the instructions given below to make the Linksys USB Network Adapter, WUSB54G, to work with a Linux system. I am making use of Fedora Core 5 (FC-5) for the purpose of this guide.
  1. WUSB54G has a prism chipset. Go to the website http://www.prism54.org. Over there one can find the Linux drivers for the device. We need to download the firmware and the driver.
  2. Before we do that, we have to make sure that the system has a precompiled kernel. Although the website says that the driver would work with kernel version 2.6.15 or up, I encountered compilation errors. The driver refers to some relayfs structure members and variables that are not defined in 2.6.15 but are present in 2.6.17+.
    So download a copy of kernel version 2.6.17 or up and compile it. We can divert our attention to the driver and firmware once we have a compiled kernel.
  3. Click on the "SoftMac/FreeMAC Drivers" section on the prism54 website. Download the appropriate firmware depending on the USB version. Copy this firmware to /lib/firmware/. Rename the file to isl3890usb
  4. Go to http://jbnote.free.fr/prism54usb/index.html for downloading the driver. One can download either the source code directly from the website or download it over the net using the Arch system (you would need to have the Arch software installed in your computer). I went with the option of downloading over the net.
  5. To compile and load the driver, execute the command 'make load' on a terminal.
Once the make load command finishes without errors, check if the driver is loaded using the lsmod command. Look for islsm*. We now need to create a device file for the network adapter.

  1. Go to /etc/sysconfig/networking/devices/. Create a new file called ifcfg-ethx (where x: is a number, I used 4)
  2. Put in the following statements, as they appear, in the file.
  3. DEVICE=eth4
    USERCTL=yes
    BOOTPROTO=dhcp
    ONBOOT=yes
    TYPE=Wireless
    MODE=Managed
    ESSID=
    PEERDNS=yes
    RATE=Auto
    CHANNEL=1

  4. Use the iwconfig to verify that eth4 is being listed.
  5. Type ifconfig eth4 up to activate the device. If all goes well, it would pick up an IP address from the DHCP server. One can verify this using the ifconfig command.
Thats all there is to making WUSB54G work with FC-5.

Troubleshooting:

Q. I get "SIOCSIFFLAGS:No such file or directory" when I execute ifconfig eth4 up.
A. If you look at the logs you will notice that the driver is not able to locate the firmware. The firmware should be located in one of the following directories.
  • /usr/lib/hotplug/firmware/
  • /etc/firmware/
  • /lib/firmware/
The first of these is what is the officially (on the website) declared location. I found, while reading a mailing post, that the second location also works. And the last one, worked for me. Another thing to check is the name of the firmware file. It has to be isl3890usb (for USB version 1) or isl3887usb_bare (for USB version 2)

Tuesday, July 25, 2006

My trip to St. Malo and Paris

This blog is long overdue. Had been planning to write it since the time I came back to US and that was..uummmm....just lets say quite some time back. But most of it is still fresh in my mind, both France and India.

I left for India on the 26th of June. I broke my journey in France to attend a conference and present my work in a satellite workshop. The conference was in a small town, Saint Malo (pronounced as Sa Malo) which was to the north west of France. Its a small, very beautiful and a very romantic place. Although my hotel room sucked big time, it had a window facing the beach and the sea. A balcony would have made the room perfect..but ah well. This was the view from my window.


I had a good nights sleep. Woke up the next day and during the shower kept cursing the french for having such a small washroom. The damn was so small that if the soap falls down, there is no way you can get the soap without bumbing into one of the walls. The walk to the conference hall was a good 30 mins over the boardwalk. Reached the conference hall and as usual was late. The conference was good, got to meet a lot of people. The most important thing was the moral boost that I was getting just talking to people about my work. It made me realize that my work is after all not worthless. People around the globe are actually working on similar concepts.

The first nite of the conference, I attended a dinner organized by IBM. Had a 4 course meal of the same dish, creppes. Although they were good, 4 course of the same thing...hmm..got me tired. However the restaurant had a prime location. Here is a view from the restaurant.
The second evening, we went to Mount Saint Michelle (pronounced as Mo Sa Michelle). Its a monestary build over the years, through the wars over a small hill or you can say mount. Aritstically very rich. And had a great view from the top. Here is a pic from the top.

After having a tour of the monestary, we were taken to attend the awards banquet at a nearby restaurant. Good wine and good food, what else could I ask for. Had a great time there. Here is a pic of the monestary from the restaurant.


The third and my last evening was spent attending a wine tasting session. By the end of which most of us were mellow, if you know what I mean. This was followed by dinner and by the time I reached my room, it was close to midnight. And it was not before 2 that I slept. Kept preparing for my presentation the next day.

The next day, after my presentation, I left to see what people call the most romantic city, Paris. I had just one day to see what the fuss was all about and guess what, that too alone.

To be continued....

Friday, May 19, 2006

Window Scaling in Linux

This document covers few details about the implementation of the TCP option, window scaling, in Linux kernel version 2.4.x.

Let me start with a brief background on why this option was introduced. The window field of the TCP header is of 16 bits. This limits the transmission rate of the TCP sender host as the window can grow to a max of 65535 (64 KB). To overcome this constraint, window scaling option was proposed in RFC 1323. This option allows the window to become a 32 bit entity as opposed to the traditional 16 bit entity of classical TCP. This allows the windows to grow upto 1 GB.

Linux implements the window scaling option. To accommodate it, all window variables in Linux are declared as u32. There are 3 variables that are used to implement this option.

linux/include/net/sock.h
wscale_ok : boolean variable
snd_wscale: stores the window scaling factor received from the remote host
rcv_wscale: stores the window scaling factor we advertised to the remote host

Consider the scenario when we receive the first SYN packet, a request to open a connection. The function tcp_v4_conn_request() (linux/net/ipv4/tcp_ipv4.c) is called for each such packet. This function calls tcp_parse_options() (linux/net/ipv4/tcp_input.c) which, as the name says, parses the different TCP options being negotiated. If the SYN packet contains the window scaling option, wscale_ok is set to 1 and snd_wscale is set to the value from the header. snd_wscale is bounded to 14. The function tcp_make_synack() (linux/net/ipv4/tcp_output.c), when creating the SYN-ACK packet, calls tcp_select_initial_window() (/linux/include/net/tcp.h) to calculate the window scaling factor to be advertised to the remote host. rcv_wscale is initialized to this calculated value.

Once the SYN packets have been exchanged, the TCP connection enters the established state. For each incoming ACK, the function tcp_ack() (linux/net/ipv4/tcp_input.c) is called. This function calls tcp_ack_update_window() (linux/net/ipv4/tcp_input.c) which, as the name indicates, is used to update our send window. The very first thing done in this function, is to multiply the advertised window by snd_wscale. The function tcp_select_window() (linux/net/ipv4/tcp_output.c) is called for calculating the window we would like to advertise to the remote host. The calculated window is divided by rcv_wscale before the function returns.

As can be seen, there isn't much to window scaling except multiplying and dividing the value of the advertised window by the right scaling factor variable.

Before I conclude this doc, I want to make a note about the sysctl variable, tcp_adv_win_scale. This variable can be seen in functions that deal with the host buffer space. This variable has nothing to do with window scaling. In Linux, the same buffer is shared by the network stack and the application. This variable decides the ratio of this sharing. The sharing of the buffer was chosen to smooth out the transition of the packets from the transport layer to the application layer.

Monday, May 15, 2006

Jo hota hai, ache ke liye hee hota hai - Really ?

Many a times I have heard people saying, "Jo hota hai, ache ke liye hee hota hai" (Whatever happens, happens for the best). But does it really ? Or thats the way we percieve it to be ?

Everyone has problems or at least thinks so. After many days of bad luck, comes one day when everything seems to work in our favor. We get so over joyed, that we forget all our problems. And that's when we hear that phrase. A way of convincing ourselves that those days of pain were worth it, making this day memorable. Another time when I have heard that phrase being used is when we are actually facing the bad phase in life. And it acts as a way of giving us hope. Because no one knows what the future holds, but we all hope that it holds good things.

That is why I wonder, does the phrase really have any reality in it ? Or was it coined just to give us hope. And since life always (most of the times) throws a good spell after a bad one, we think that the phrase is true. I am sure everyone has their opinion about it. And mine is that it was coined to give us hope. And the events in life has made us to believe that the phrase is true.

However, whether it is true or not, the phrase does give us hope. And hope is something with which one can live his/her life.