473,378 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

parallel programming

Hi all,
Is it possible to write parallel programming in C?
I mean for example a simple program like I have a clock on a program
that show me current time and and at the same time another job like
input data from a user.If it is possible PLZ write a simple code for me
..

Nov 19 '05 #1
3 2693
On 18 Nov 2005 23:21:38 -0800, pa****@gmail.com wrote in comp.lang.c:
Hi all,
Is it possible to write parallel programming in C?
Not in standard C, no. The language defines an abstract computing
machine that does exactly one thing at a time.
I mean for example a simple program like I have a clock on a program
that show me current time and and at the same time another job like
input data from a user.If it is possible PLZ write a simple code for me


There are extensions to C, and other languages, that provide ways of
doing this, if the underlying platform provides support. But they are
not part of the C language and outside the scope of this group. You
need to ask in a group that discusses programming for your particular
compiler and operating system combination to learn about what
extensions it might offer.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 19 '05 #2
<pa****@gmail.com> wrote

Is it possible to write parallel programming in C?
I mean for example a simple program like I have a clock on a program
that show me current time and and at the same time another job like
input data from a user.If it is possible PLZ write a simple code for me
.

There are lots of solutions to the problem of writing parallel C code. For
example there is a language called "parallel C" with instruction like "pfor"
( a for loop which can be executed in parallel).
The one that seems to have caught on is the message passing interface, or
MPI. Superficially it looks like a familiar series of C function calls. In
fact you need a special compiler - it cannot be implemented as a normal
library.

All of them are currently off-topic. (There might be an argument for
expanding the scope of the ng to include parallel implementations, but
presently the convention is that we confine ourselves to ANSI C)
However you don't need true parallel programing to achieve parallel
execution.
For instance as long as you can call a routine called update_clock() more
frequently than once a second, the clock will appear to the user to be
ticking along in parallel.

ANSI C input functions are blocking, so if the user waits five minutes
before pressing the newline, getc() will wait for him. However there are
always extension like "kbhit" available which get round this problem,
allowing you to check for input and, if it is not present, update the clock.
Nov 19 '05 #3
Malcolm wrote:
<pa****@gmail.com> wrote
Is it possible to write parallel programming in C?
I mean for example a simple program like I have a clock on a program
that show me current time and and at the same time another job like
input data from a user.If it is possible PLZ write a simple code for me
.


There are lots of solutions to the problem of writing parallel C code. For
example there is a language called "parallel C" with instruction like "pfor"
( a for loop which can be executed in parallel).
The one that seems to have caught on is the message passing interface, or
MPI. Superficially it looks like a familiar series of C function calls. In
fact you need a special compiler - it cannot be implemented as a normal
library.


That is exactly how it is implemented, even though a wrapper is supplied
for each supported compiler, and it is possible, though misguided, to
avoid the wrapper and invoke your C directly.
You may be thinking of OpenMP, which is impractical to implement without
at least a special pre-processor. There are also compilers which can
implement a limited subset of OpenMP simply by throwing a command line
switch.
The OP problem looks more like homework aimed at the beginnings of
teaching about an operating system, not what many of us think of as
parallel programming. Yes, it is possible to write an OS largely in C,
e.g. gnu/linux. Still OT, as it hasn't been done in purely standard C.
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Yuancai \(Charlie\) Ye | last post by:
Hi, All: I am happy to annouce that we have formally released our latest SocketPro version 4 at www.udaparts.com, an advanced remoting framework written from batching/queue, asynchrony and...
10
by: Joshua Nussbaum | last post by:
I came up with what I think is a good idea for making multithreading programming easier in any .NET language. I dont know where else to post it, so I'll try here. ..NET 2.0 adds the capability...
10
by: bpontius | last post by:
The GES Algorithm A Surprisingly Simple Algorithm for Parallel Pattern Matching "Partially because the best algorithms presented in the literature are difficult to understand and to implement,...
9
by: MNQ | last post by:
Hi All I want to use my parallel port of my PC to control some external devices. I am writing a program in ANSI C using the PacificC compiler. What I need to know is how to access the parallel...
126
by: ramyach | last post by:
Hi friends, I need to write a parallel code in 'C' on the server that is running SGI Irix 6.5. This server supports MIPS Pro C compiler. I don't have any idea of parallel C languages. I looked...
0
by: fiepye | last post by:
Hello. I am interested in parallel computing in Python. Except other modulesI would like to use new modules for vector and matrix operations and scientific computing SciPy and NumPy. I have...
26
by: Prime Mover | last post by:
Hello all, I have got the pseudo-code below that I would like to convert to c language. The algorithm calculates Pi value. I am somewhat familiar with C language, but I am just starting to learn...
3
by: John | last post by:
I have a program that needs to run on a regular basis that looks at a queue table in my database. If there are items in the queue database I need to grab the data from the database and pass it to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.