By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Multi user programs

P: n/a
Hi, I'm relatively new to programming and I would like to create a C++
multi user program. It's for a project for school. This means I will
have to write a paper about the theory too. Does anyone know a good
place to start looking for some theory on the subject of multi user
applications?

I know only bits and pieces, like about transactions, but a compendium
of possible approches to multi user programming would be very
appreciated!

Nov 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 2005-11-21 12:38, bo********@gmail.com wrote:
Hi, I'm relatively new to programming and I would like to create a C++
multi user program. It's for a project for school. This means I will
have to write a paper about the theory too. Does anyone know a good
place to start looking for some theory on the subject of multi user
applications?

I know only bits and pieces, like about transactions, but a compendium
of possible approches to multi user programming would be very
appreciated!


What exactly do you mean with multi-user? Several users using different
instances of the same application at the same time or multiple users
using the same instance of the application at the same time (kind of
outdated now days).

The easiest approach would probably be some kind of client/server
solution. Then you would only have to worry about locking on the server-
side. With some luck you might use a database and let it do all the
locking for you (which is good since it can be hard to get right).

Haven't got many tips about books/articles to read but taking a look at
your local library for books about concurrent computersystems might turn
something up. Not sure if it's good but I've read 'Multithreaded,
Parallel, and Distributed Programming' by Gregory R. Andrews, I suspect
it's as good as any.

Erik Wikström
--
"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure
out how to use my telephone" -- Bjarne Stroustrup
Nov 22 '05 #2

P: n/a
<bo********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, I'm relatively new to programming and I would like to create a C++
multi user program. It's for a project for school. This means I will
have to write a paper about the theory too. Does anyone know a good
place to start looking for some theory on the subject of multi user
applications?

I know only bits and pieces, like about transactions, but a compendium
of possible approches to multi user programming would be very
appreciated!


It depends on what you mean by Multi User Programming, but the common
understanding is a Multi User Program will allow two instances of the same
program to access the same database files at the same time.

The way this is done is with record locking. Normally a program opening a
file for write has a file lock on it, meaning no other program can open that
file for writing until the program closes it. A Multi User Program will
open a file in "shared" mode and use record locking. Meaning this program
will now explictly place a record lock on a record it has open for write
(update) so no other program can read that same record for write.

Record locking is normally handled by some database system, such as SQL, and
SQL itself handles the record locking requests, although later verisons of
Windows handle record locking directly in the OS.

There is another form of Multi User Applications which share data. An
example of this would be a "whiteboard", where 2 computers connected via a
network can edit the same data. This is normally handled by each instance
of the application sending update information via the network to the other
instance of the application which updates it's own copy of the data.

Then you can have an application using shared memory. Each instance of the
application would look at the same memory as another instance of the
application. Again, you use locks, but now you use some form of memory
locks. I'm not sure if mutexes extend across applications.

With the advent of the internet, however, we see many forms of multi user
applications. IRC could be considered a form of a multi user application
(as well it could not be considered a form, it depends on your definition).

An MMORPG such as Everquest could be considered a form of a multi-user
application also, although it uses a client/server architecture.

This is really not a C++ question, however.
Nov 22 '05 #3

P: n/a
>>> Hi, I'm relatively new to programming and I would like to create a C++
multi user program. It's for a project for school.

I would suggest you first have some idea about the application you want
to build.

Technator
www.hcl.in

Nov 22 '05 #4

P: n/a
technator wrote:
Hi, I'm relatively new to programming and I would like to create a C++

multi user program. It's for a project for school.

I would suggest you first have some idea about the application you want
to build.

Technator
www.hcl.in


It wil be a C++ program wherin two or more users will share a datafile.
the project is meant to convert the current, single-user application,
to a multi-user application. The current software architecture of the
program consists of the program opening a text-based file and reads the
data from there. It is in problem to convert to a database, but it is
requested not to.

The program has to be run on serveral computers simultanuously. There
should be some data hiding, users are meant not to see all data, but
subsets of the data.

I would like to know what possibilities there are in regard to
multi-user programming. Is it possible to share a data-file on a
computer? What if I don't use a database? Stuff like that!

Thanks to anyone who replied!

Nov 23 '05 #5

P: n/a
On 2005-11-22 11:31, bo********@gmail.com wrote:
technator wrote:
>>> Hi, I'm relatively new to programming and I would like to create a C++

multi user program. It's for a project for school.

I would suggest you first have some idea about the application you want
to build.

Technator
www.hcl.in


It wil be a C++ program wherin two or more users will share a datafile.
the project is meant to convert the current, single-user application,
to a multi-user application. The current software architecture of the
program consists of the program opening a text-based file and reads the
data from there. It is in problem to convert to a database, but it is
requested not to.

The program has to be run on serveral computers simultanuously. There
should be some data hiding, users are meant not to see all data, but
subsets of the data.

I would like to know what possibilities there are in regard to
multi-user programming. Is it possible to share a data-file on a
computer? What if I don't use a database? Stuff like that!


Since it has to run on many different computers at the same time a
server/client solution would be the best. Write a server application
which has access to the file, and client applications which sends
requests for reading/writing to the server (which does the acctual work).

An easy solution could be to have several threads on the server which
accepts connections from the clients, places the request in a queue.
Another thread services the requests one by one from the queue. Then you
would only have to use a lock to access the queue (and there are lots of
examples of the producer/consumer pattern out there to look at).

If the file is very large or you expect very many clients a databases
server might be better, then you only have to program the clients and
can use ODBC or something similar to connect to the database. The pros
with a database is that you don't have to worry about concurrency or how
to select which parts of the file to send to the clients (if the data is
well structures a nice SQL-query will take cara of that) and it's fast.

Erik Wikström
--
"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure
out how to use my telephone" -- Bjarne Stroustrup
Nov 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.