Thursday, May 26, 2011

New car

From last few days, I have been thinking about a designing a car. I know, it sounds unreal but I like to imagine :) If I were to design a car, here is my wish list.
- It should be a hybrid (diesel + electric motor). I prefer diesels :)
- It should be fun to drive (good handling)
- It should be economic enough to drive. (better value for money)
- Wherever possible, it should try to generate energy. e.g. the brakes, the suspension, the chassis, the transmission, the tyres (?) should be regenerative.
- It should have automatic switch to run on electric motor under certain circumstances.
- It should maximize the fuel efficiency than any other car out there.
- It should have a better footwell with well organized peddles. I prefer long peddles where you can rest your whole foot.
- It should be spacious.
- The seats should be comforting.
- The suspension should have multiple modes like - comfort (soft suspension), sports(rigid suspension) and BoBW(Best of both worlds)
- All necessary gadgets.
- Being a diesel, it should a good turbo to boost the power.
- The torque curve should be linear or flat.
- Minimal or no turbo lag.
- Good AC with minimum load on engine.
- A good linear, progressive clutch (this is very necessary and is neglected by almost every manufacturer)
- I would like to keep about 10 - 12 % of power as reserve to use as needed. I would like to have a boost while overtaking :). About this, I was thinking about keeping a spare cylinder (a small one) and while the car is running on engine power, it should not use power output of this spare cylinder but it should be available on demand. (this is just a requirement and not the design :). The design might be much more difficult)
- Instead of having one turbo, I would like to have 2 turbos - a small one and other big one. They will work in mutually exclusive fashion. The small turbo should start spooling early in the rev range (will have advantage of being small) while the big one will take over after a threshold.
- About the hybrid nature, the diesel engine when running should charge the battery and all regenerative energy should be used to charge batteries.

Thats it for now. Will add more as I remember more :)

Tuesday, June 8, 2010

Is there any software to automate the software development process?

I ran through this thought few days back. In most of the software development scenario, the processes to be followed, the compliance to be adhered is either absent or left to individual imagination. Such cases lead to inconsistent rather faulty development process.
The solution is simple - develop a process and ask everyone to follow it. Now the later part is the difficult one. While I am writing this, I admit that I have also made mistakes in my past software development experience. When I look back to those mistakes, I realize these things went wrong due to lack of supporting processes and the clarity to follow it.
Since putting processes in place is easy but following them is difficult, why cant we develop software to do that? Meaning??
Meaning - develop a software which would act as your development environment and will basically take care of all intermediate subtasks like -
  • requirement gathering
  • mutual consents
  • producing documentation, seeking feedback, incorporating comments
  • designing project plans, identifying resources, identifying tasks
  • Implementation
  • Quality Assurance and bug fixing cycles
  • Code reviews
  • Issue tracking systems
  • Source Code Repositories
  • Rolling out releases
  • Customer Interaction
  • Product Road map
This software is not intelligent enough to write the design doc but it will definitely help to speed up writing the doc. When development teams are geographically distributed, it gets difficult to grab the next person's views/thoughts. This software can help you to identify the right person and seek a proper sign off so that there are no surprises in the requirements.
This software will help streamline the process so that there is no way one can violate the process. The process could be decided by the authority and can be put in to the software.
Right now, I am trying to find out such products and a proper name for products that fit into such categories.

Update: I found one. FogBugz from FogCreek Software seems to be built on the same lines but I dont think it is the complete solution I am thinking of.

Wednesday, June 2, 2010

Traffic Jams in Pune

Yesterday, there was a heavy rainfall and it poured like anything for an hour and half. As an obvious result, power lines were busted, trees fell in many places. And ultimately, all the arterial roads were jammed.
My daily commute from Office to my home usually takes 15 minutes. And yesterday, I spent close to an hour on the road. The rains had stopped but the traffic was moving with baby steps - few meters every 5 minutes. While on the road, I was thinking about why such situation occurred in first place. A plain Jane answers was fallen trees and the out of order traffic signals. Given more thought, I found out the exact reason why the roads get jammed whenever there is a moderate to heavy rainfall.
The reason was - the traffic signals do not work in sync with each other. Take a simple example. Suppose there are 2 cross roads in close succession. There is a traffic signal at each crossroad. Distance between these 2 crossroads is lets say 2 km. Now as soon as rain starts pouring down, due to open nature of power transmission, there are probably short circuits in the power system and lots of areas suffer from power loss. As a result, traffic signals stop working. In addition, due to fallen trees, there are more stumbling blocks for the moving traffic. Now during peak hours, the arterial roads are clogged due to heavy inbound/outbound traffic. And since traffic signals are not in sync with each other or with the nearest ones, lets says, I get a green signal at the first crossroad. Now I am moving to the next crossroad which is 2km away. Now here, due to power loss, the signal at second crossroad had stopped working. As a result of this situation, while one gets a free route at first crossroad, he/she gets stuck at the second crossroad. And this whole mess ultimately leads to chaos on the road.
Key points to be noted...
  • Adjacent traffic signals do not work in co operation.
  • Fallen trees create new choking points.
Let us keep apart the fallen trees aside for a while. A simple solution would be to make adjacent traffic signals co operate with each other. If the adjacent signal is not working, the next signals should know about this situation and they can take corrective measures. The next signals can stop working after knowing that earlier signal is not working.
Well, we need a multi pronged approach to remedy this problem. Roads bearing most of the traffic can be identified. All roads leading to / forking from these roads should be identified and all signals on these roads can be made to work in close co operation with each other.
Such a system will greatly reduce the burden of traffic management from traffic police and it will help to neutralize the surge in incoming/outgoing traffic. This system can be further evolved by mapping all the roads in the city and formulating proper procedures for them in case of disaster.
Few things that puzzle me like - traffic signals are one of the most important things that run on state provided power supply system. Further traffic signals are tuned to work at second level granularity. Manual intervention by traffic police can not be a substitute for automated traffic signals. In my opinion, the first thing to do - is to give a backup power line to all traffic signals and try not to cut power to this backup line.
I am still thinking about this problem. May be, I will come up with a more sophisticated version of my solution in near future.
Update: Got to know about a traffic regulation system by BMW and Audi. But these solutions aer way to sophisticated and need dedicated hardware to contact the traffic signals nearby. Check out this link -

Tuesday, August 11, 2009

New business plan???

Spoiler Alert: Crazy thought
Few days back, I had a weird thought about a business idea. We all Indians know that corruption is wide spread in India and it is often cumbersome to deal with authorities and government officials.
How would it if we have a company which would do the job of interacting with authorities for you? I know, I know, this is not a new thing.
So the differentiating factor is - this company would guarantee a transparent business with no corruption whatever. This company would act as an interface between the consumer (big organizations, NGOs) and the authorities.
New regulations like RTI (Right To Information) could be helpful here. But running such a company would be a real pain which is why it would need a substantial change in though process and business logic.
This company would need hard bound approaches in order to deal with govt authorities which need to be fool proof and be completely transparent.

Tuesday, August 4, 2009

Think different!!

I often think you need to think on different lines to come up with something innovative, something useful. I am not inventing a new thing. And I don't know the definition of Innovation. But this is how I usually define innovation - find out something that is based on some underlying invention (fact). So your innovative idea could be an old thing but the way you do it is important.
I like to think on different lines. Basically the problem with our approach is there is very little room to think on your own or most of the people go with the flow rather than thinking it through.
So now onwards, I will post all the crazy ideas that strike me. It doesn't matter (at least to me :P ) if they are useful or total crap. I firmly believe this is the way your though process evolves.
And through small things, you can create a big picture.

Sunday, August 3, 2008

Scalable directories

While working on my current project, I felt the need of having big, scalable directories. The problem with directories in a traditional system is that they are not really scalable. The directory search is linear and it incurs a heavy penalty when the directory is big. There's gotta be some way to reach to the needed directory entry given a name. The traditional UNIX convention of directory being a regular file is just not good enough. Well, directory being a file, eases a few things for sure but it does not help in itself being the directory. We will brief few short comings of traditional directories.
1. Directory is a regular file.
2. Directory does not scale well.
3. Directory search is linear. Bigger the directory, bigger the performance hit.

This problem gets worse for distributed file systems. If number of clients are writing to the same directory, there would be a lot of IOs until the cache is warm. Of course, the size of cache does matter while dealing with large number of clients. So what we need is -
1. Do something extra for the directory.
2. Make the directory search efficient.
3. If the underlying file system is a distributed file system with large number of clients writing to the same directory, use range locking so as to have fine grained locking primitives to parallelize the directory access.
Few projects show indeed such initiatives are underway like this -
These things make sure that we are on the right track to scale directories.
A directory should have some kind of indexing which helps to locate the required data set in constant time. Insertion and deletion should be fast enough to accommodate multiple clients simultaneously. Directory deletion which includes deletion of all its contents should be faster.
Going further ahead, this topic leads to the relation between a file system and a database. Are they similar? Are they different?
IMHO, file system and databases are totally different. File system is more of a father figure for a database or for any application for that matter. A file system does much more than storing and retrieving data as compared to a database. Both of them try to efficiently store and retrieve data, both of them flaunt transaction logging mechanism and both of them try to be consistent all the time.
The solution could be to blend the best of both. And I would prefer blending database techniques in a file system. So a file system can gain from blending a relational database schemas with it. A simple example of this could be tagging. A file system can sport tags that are equivalent to a directory with respect to grouping things together. A file system can have database like transaction semantics (all or nothing) while doing updates. Essentially all of this would help to make the file system scalable as well.

Thursday, July 17, 2008

UNIX privilege protection

Recently I am developing a feature where I need to protect a file from all users including the root. Most of the kernels do this by restricting the permissions stuff and/or attaching some special flags with the files notifying that this file should not be touched. While shaving this morning, I had a weird idea.
I want to protect a file, so restricting the permissions to root is an obvious thing to do here. But still root can modify this file. If I want to block root user as well, what if I had an another internal root like user? This would also be a root user, say a root cousin which is invisible to outside world. So in this case, root can read the file but can not modify it. I know this breaks the standard UNIX legacy we have that there is only one powerful god and that is root. What if we shatter this? There would be more than one god, so would there be a clash of titans? No, the rule is one god does not interfere with other god. The gods are read-only while interfering with another god. In this case, it gives an impression that root user is not able to modify certain file. Since internally this file is owned by root cousin, root is not able to change/modify it. So the change of behavior is quite noticeable. I don't know if this would be acceptable.
Since this root cousin is invisible to end user, he/she can not inherit root cousin privileges. And a root user can not change/modify the files that need to be protected.
This is a very simple idea and might have occurred to a lot of people. The moment I struck it, I felt like noting it down somewhere and thats why I am posting it here. I still need to figure out how to implement this. Will update about it soon.
Few basics on how to implement this. This root cousin needs a dedicated uid and gid at least for UNIX. This uid and gid can not be used by end user. Kernel uses this identifiers for its own protection. So there is no way an end user can make a file owned by root cousin. Only the kernel is able to use these dedicated uid and gid in order to protect some files even from root. So it is quite obvious that we should not use these root cousin privileges everywhere. Rather, its use should be kept to minimal. For files, we don't want even root to change/modify, we should make them own by root cousin. While displaying the file properties (ls command), should we display the dedicated uid and gid for root cousin or should we show root uid and gid instead? If we show root uid and gid, the end user will still have the illusion that these files are owned by root but they can not be changed/modified. Great!! This goes well with the UNIX methodology. Lots of questions are popping in my head. Will update again as I have more answers.