Posts Tagged ‘c programming’
This is how projects get done . .
Programmer to PL:
“This is Impossible. It will involve design change and nobody in our team knows the design of the system. And above that nobody in our company knows the language in which this software has been written. So even if somebody wants to work on it, they can’t. If you ask my personal opinion the company should never take these type of projects.”
(more…)
Career and Programming Songs for all Professionals . .
1. when in college !!
–Hum honge kaamiyaab, Hum honge kaamiyaab ek din…..
2. when giving interview to Multi National Company
–Tu hi re.. Too hi ree. tere binaaa main kaise jiyunn….
(more…)
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
