pande.info

OLTP…

OLTP



What Is This..
——————–
‘oltp’ is a simulator for online transaction processing in a multiuser system
like UNIX/LINUX.A real time oltp application can process transactions(READ-WRITE-
MODIFCATION on a master data base file) done on different terminals with only one
system as server & all connected through a network.

Why I Wrote oltp:..
—————————
I finished my training on “Advanced C/UNIX” in “Uttara-Software training Centre,
Bangalore”.At the end of training we have to do one project in C on UNIX platform.
And oltp is “the best” assignment which has most of the Unix/Linux internals.
In real time, there will be a network through which all processes on different
terminals should communicate.But in HOME…a simulator & that is….oltp.

Two classes of SOLUTIONS to Concurrence Problem..
————————————————-
1.Decentralized OLTP:
Here every process is going to have READ-WRITE-MODIFY permissions on master database
file.Here one can use File locking/Data locking to along with some semaphores to
protect the integrity of the Master Database file.
2.Centralized OLTP:
Here only one process has got READ-WRITE-MODIFY permissions on master database file
& is called server process running as deamon.All other processes have request this
server to their job.This what is called as a Clint-Server Model.
“oltp” –what I wrote is also a simulator for Clint-Server Model.

About System/OS..
—————–
I wrote oltp on My PC with
-Mandrake Linux 8.2 [As UNIX environment]
-ncurses v5.2.x [For User Interface for Unix terminal]

Overview of oltp..
————————
1.A header file [oltp.h] with structure definitions for our message,account etc.
2.A server.c [server_oltp.c] having all IPC initilisation routines like semget(),
msgget()..etc.Also routines like setpgrp() for Deamon process.
3.A clint.c [clint_oltp.c] with some user interface to get user input.

Befor Going through the CODE..
——————————
-You should have a fair ammount of knowledge about system V IPC.
-Curses.

Books I am Referering..
—————–
-UNIX Network Programming…By W.Richard Stevens
-Vijay Mukhi’s– The ‘C’ Odyssey

How Server & Clints Interacting..
———————————
–They are communicating through a massage que with OLTP_MSGID[..in oltp.h].
–We have our own OLTP_MSG_BUFF for massage.Server is waiting for the clint to
send massages then replies back to clint.

Channels of communication..
—————————
–Clints are requsting for channel to the server for future communication through
Master Channel[MASTER_CHAN].
–Server is sending replies through massage que with massage type as clint PID
–Usage of PID is just for the simplicity.In real time..We have to go for some other
Technique.

About User Interface using ncurses..
————————————
– I am using ncurses for the first time..Please EXCUSE ME ! ! !
– You can ALWAYS get documentation at – HERE

About Files,Compilation..
————————-
–Compile clint_oltp.c using gcc ./clint_oltp.c -lncurses -o ./oltp_clint
–Compile server_oltp.c using gcc ./server_oltp.c -o ./oltp_server
[ELSE use script "ccoltp" to do JUST that.]
To get two excutables in current directory.

Run:

$./oltp_server install————- /*To create MDF.dbase in current dir.*/

$./oltp_server start ———/*To start oltp_server as DEAMON which
is dumping all logs in a file OLTP_server.log
in current dir*/

$tail -f ./OLTP_server.log ———————–/*To Monitor logs*/

$./oltp_clint———————– /*To start a clint process*/

$./OLTP_server stop —————–/*to remove semaphore & message que if for some reason server dies unexpectedly to remove semaphore & message que*/

Download the source code – HERE

Don’t forget to leave your comments – HERE

No related posts.

Tags: , , ,

25 Responses to “OLTP…”

  1. August 6th, 2007 at 4:02 pm

    pande says:

    oltp which I wrote is for Linux/Unix.

  2. August 4th, 2007 at 7:03 pm

    Apoorva says:

    Hi,
    I am not able to write the decentralized solution properly. Since your program works as in window programming, but the program should work in Unix C programming. Please help me.

    Apoorva

  3. April 1st, 2007 at 9:58 pm

    Apoorva. V. Hunnur says:

    Hi,
    I tried many times still I haven’t got the output to clint.c program. So please tell me any changes I have to make to the program to get the output. I think that you have not initialized the getmaxyx(), raw(), endwin(), echo() etc in the program.

  4. March 30th, 2007 at 8:03 pm

    pande says:

    HI,
    getmaxxy, raw, endwin, echo etc are the APIs provided by ncurses library… please read a manual on web http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/

  5. March 30th, 2007 at 3:17 pm

    Apoorva. V. Hunnur says:

    Hi,
    But in client.c program, you have used getmaxyx(), raw(), endwin(), echo(), noecho(), keypad(stdscr, TRUE) and others and I did not got the output to client.c program. Please tell me any changes I have to make in this program.

  6. March 29th, 2007 at 8:21 pm

    pande says:

    Hello,
    client.c is written for Linux only. Infact, client.c uses ncurses for it’s User Interface which is available only on UNIX/Linux..etc

  7. March 28th, 2007 at 10:55 am

    Apoorva. V. Hunnur says:

    Hi,
    Actually the program of client.c is done using windows, but we use linux programming in uttara. please tell me how to change this program as early as possible.

  8. March 22nd, 2007 at 1:13 pm

    Apoorva. V. Hunnur says:

    Hi,
    Can you please tell me the output of these 2 programs as soon as possible.

  9. March 18th, 2007 at 1:57 pm

    Apoorva. V. Hunnur says:

    Hi,
    If I want to write A program only on Semaphores, then what are the changes I should make to OLTP client. Please tell the changes as early as possible.

  10. March 7th, 2007 at 5:15 pm

    Apoorva. V. Hunnur says:

    Can you be clear in what you wrote. Actually I want to know whether if I can convert Centralized OLTP into Decentralized OLTP, by just doing minor changes.

  11. March 7th, 2007 at 4:42 pm

    pande says:

    may be use a semaphore in OLTP client to guard the database file. Then in each client, try to get the semaphore for any read/write operation. You can even use file lock/unlock mechanism to do this. We dont need a server anymore. And each person will just open a OLTP client application and try to do any updation in the database file.

  12. March 7th, 2007 at 3:59 pm

    Apoorva. V. Hunnur says:

    Hi,
    Can you tell me what are the changes I should make in Centralized OLTP to convert it to decentralized OLTP.

  13. February 27th, 2007 at 9:24 pm

    pande says:

    for decentralized OLTP, you should use file LOCK/UNLOCK mechnism provided by linux to syncronize read/writes from two different clients….

  14. February 27th, 2007 at 5:17 pm

    Apoorva. V. Hunnur says:

    Hi,
    Can you tell me how to write a program on
    Decentralized OLTP.

  15. February 5th, 2007 at 5:10 pm

    Apoorva. V. Hunnur says:

    I also want to know whether the program clint.c can be used for writing the program on semaphore, message queues and shared memory.

  16. February 5th, 2007 at 5:08 pm

    Apoorva. V. Hunnur says:

    Dear Pande,

    Can you Please guide me through for this project.
    How to use FIFO and Pipes in the Program.

  17. January 25th, 2007 at 12:33 pm

    pande says:

    Hi,
    clint.c is for centralized and contains all the IPC operation including semaphore and Message Q. Semaphores used to guard the write operation. Only one client is allowed to have write permission.
    Hope this info helps… :)

  18. January 24th, 2007 at 10:25 am

    Apoorva. V. Hunnur says:

    Hi,
    I want to know the program clint.c is written for decentralized OLTP or semaphores or message queues or IPC’s. And also tell me whether I can use the program
    clint.c to write program for semaphores, message queues, shared memory, fifo’s and also tell me whether there is a change in the program. If it is there tell me what the changes are. Please send me the reply as early as possible.

  19. January 19th, 2007 at 10:57 am

    pande says:

    Hi Apoorva,
    I have done only OLTP that too without Sockets.. i.e, not a networking project. May be you use the sourcecode which is on programmersheaven.com and add socket support.
    Hope this helps.
    Best of luck :)

  20. January 19th, 2007 at 10:52 am

    Apoorva. V. Hunnur says:

    Hi,
    Actually we have to do 8 mini-projects and one project using networking. Please if you can help with these projects.
    I have to do project using Semaphore, message queues, IPC, channel selection, shared memory, channel of communication, centralized OLTP and decentralized OLTP. Please give a reply as early as possible

  21. December 24th, 2006 at 5:11 pm

    Apoorva. V. Hunnur says:

    Dear Pande,
    Please send me the source code of all the project done at uttara as early as possible. Please help me to solve this project.

  22. December 23rd, 2006 at 11:12 pm

    Apoorva. V. Hunnur says:

    Please send me the source codes of Advanced C/Unix done at uttara as early as possible.

  23. December 18th, 2006 at 9:00 am

    pande says:

    The source code is on programmersheaven.com. Just check whether you can download…

  24. December 17th, 2006 at 12:19 pm

    Apoorva. V. Hunnur says:

    Can you Please help me by sending the code of the project as I want it very badly. My e-mail ID is apoorvahunnur@yahoo.co.in. Please send the code of the project where you are doing it using Saving bank application Program using OLTP, Semaphore, etc. Please send it as early as possible.

  25. September 27th, 2004 at 12:22 pm

    poonam yadav says:

    hello
    thanks for presenting such nice projects

Leave a Reply

Spam Protection by WP-SpamFree