Monday 2 May 2016


Analysis of Virtual memory on Performance:


I have written a 4 pages paper on experimental analysis of different aspects od virtual memory and its optimisations. Here are the details of this project http://goo.gl/IH9uTn. Link for the paper and code for experiments is given below.

Report : https://goo.gl/99zWRa
Code files: https://goo.gl/Gqkjj3

Log Structured File System:


I have implemented a log structured file system using FUSE and C on Linux for this project,Basic functionalities implemented in this project are : 

  • Reading and Writing Blocks
  • Reading and Writing Blocks through Inodes
  • Introducing a Directory
  • Making data blocks log-structured
  • Making inode blocks log-structured 
  • Indirect blocks 
  • Checkpoints 

Following are the formal definition and code files for this project.

Description: http://goo.gl/xvugGC

Project Files: https://goo.gl/wvRSrH
Service Oriented Computing:

It was a semester long proejct in which I had to develop an Investment and Portfolio Management System (IPMS) that is built on top of service-oriented architecture to provide customized solutions for asset management, pension/retirement plan management, trading management, and fund distribution and reporting processes. After basic services I developed composite services using WSDLs of local and 3rd party services to automate most processes using BPEL. Following are the links for complete description and project files.

Project Description: https://goo.gl/sP0E5A
BPELs Description: https://goo.gl/H8aa8b
Project: https://goo.gl/svWCpv
Cache simulator:

This lab helped me understand the impact that cache memories can have on the performance of C programs. The lab consisted of two parts. In the first part I had to write a small C program (about 200-300 lines) that simulates the behaviour of a cache memory. In the second part, I optimised a small matrix transpose function, with the goal of minimising the number of cache misses.

Following are the downloadable file:
Description: https://goo.gl/5TKvf7
Project: https://goo.gl/O1uCT4
Multicore Computing - N-Body Simulation:


Following is the description of assignment:

N-body simulation [1] is the simulation of particles under the influence of gravity. E.g. planets, stars in a solar system. In this assignment, you will work in a 2D world and ignore collisions.
A straightforward O(n^2) algorithm can calculate the movement of each object using Newton’s laws and leapfrog finite difference approximation scheme. In this scheme, you take discrete time jumps of a given time interval and at each jump calculate the new force, new acceleration (assuming constant force during the time interval), new velocity (assuming constant acceleration during the time interval), and new position (assuming constant velocity during the time interval) of each particle. A small time interval gives a more accurate simulation.
Barnes-Hut algorithm [2] is an O(n log n) algorithm that approximates the effect of a set of distant objects. You need a Quad-tree (Each node has four children) for this algorithm. This algorithm takes an additional parameter of the error threshold. Read the detailed description from this link.
There are five part of this assignment having equal marks.
Part 1: Implement the N^2 algorithm (C++)
Part 2: Parallelize the N^2 algorithm (Cilk/OpenMP/Intel TBB) and report scalability with at least 4 cores on different simulation sizes.
Part 3: Implement Quad-tree + N-log-N algorithm (C++)
Part 4: Parallelize the N-log-N algorithm with reader-writer locks on Quad-tree (C++ Threads or Pthreads) and report scalability with at least 4 cores on different simulation sizes.
Part 5: Repeat Part 4 but without any locks and using transactions instead (C++) [4]
Input should contain the time interval (dt), iterations to simulate, error threshold, the number of objects to simulate, their initial velocities and positions in double format. For testing you can generate random velocities and positions. If you are interested, you can also get actual initial parameters of planets in our solar system [3]. Test it on up to at least a 1000 objects.
Output should contain the final x,y position of each of the objects on a separate line. Needless to say the output of the first two parts should be the same for a particular input and the output of the last three parts should be the same.

I have implemented all the parts of this assignment using C++. You can download the project from https://goo.gl/RQsVBe
Web Crawler:

In this project I have crawled the website http://lums.edu.pk/ till the depth of 10 pages from one page. I have developed the assignments in two parts; 

-First one is URLsFetcher which fetches all the urls and their html content and saves data in 2 separate files in D drive, keeping the index common for URL and its content in corresponding file(I have used this technique to make the search faster using basic form of indexing).

-Second is the application interface in which user can enter query to be searched and it parses the content txt files to get the results and it saves the searched queries persistently(you can re open the application and all the previously searched term would be in suggestive drop down using auto-complete). We can update the txt files by running the URLsFetcher again and web crawler part will work on it as well. I have used multi-threading for searching and content writing

PS: I have attached screenshot of app, code both programs and all txt files. Technology and IDE used: C#,Windows Form Application, VS2012.

PDF: https://goo.gl/n6vbS3
Project Files: https://goo.gl/fyrXd1

Distributed File System Prototype:


In this project I have used asynchronous sockets to enable multiple clients to connect to a server. I have developed the following functionalities of DFS assignment. 

1. CreateFile(char*filename): Server returns 1 if a new file is created in its local directory on the behalf of user’s request. Filename can be up to 30 characters. Server returns -1 if a local copy of same filename already exists or there is some other problem.

 2. OpenFile (char *filename, int mode): Opening a file means creating a local copy of the file at client’s end and client performs read and write operations on it. Mode can be “read” i.e. 0 or “write” i.e. 1. The system only allows 1 client to open a file in write mode at a given time. If call is successful, the call returns a positive value i.e. file descriptor. This file descriptor is subsequently used to perform read/write operations. Server returns -1 if file doesn’t exist or -2 if file has already been opened in write mode by any other client. 

3. ReadFile (int fd, char *buffer): This call reads the contents of file described by its file descriptor and fills the buffer with it. The contents should be printed on client’s screen. 

4. WriteFile(int fd, char *buffer, int length, int mode): This call writes the contents of buffer in a file described by its file descriptor “fd” up to the given length. Writes can happen in 3 different modes. i. Blocking: In this mode, file will be written to server and the write update is sent to all the clients who have opened this file in read mode. We call such clients as active replicas. Once the server and all replicas have been updated, call to this function returns with 1. ii. Non-Blocking: In this mode, file will be written to the server and it returns with a value = 1. That means, only the server has been updated and all the subsequent replicas are yet to be updated who have opened the file in read mode. iii. Disconnected: In this mode, the file is written on the local directory of the client. This is suitable for a mobile client who may not be connected to the server all the time. The server and replicas are only updated when the client closes the file. Technology Used: I have used mono and Xamarin as IDE for this assignment and language used is C#.

Here are the links for assignment description and projects files.
Project File: https://goo.gl/nXRsPN