Search Results

Search: Posts Made By: saman_glorious
Forum: Programming 03-20-2011
2,167
Posted By saman_glorious
Thread function local variables
As I know threads share the memory. But, what about the local variables in the thread function? if i call multiple threads would they allocate seperate local variables for themselves?

like
...
Forum: Programming 03-18-2011
2,951
Posted By saman_glorious
I revised my code. Now the output is: ...
I revised my code. Now the output is:

user@user-desktop:~/Desktop/gossip$ ./a.out
mutex_nodes initialized..path_mutex initialized..nodes[0].f_lock initialized..nodes[1].f_lock...
Forum: Programming 03-16-2011
2,951
Posted By saman_glorious
Multi-threading
In this piece i implemented the gossip method. The first thread is invoked from inside the (msg is first sent from node -1 to 0 from main()) and the other threads are invoked from inside of the...
Forum: Programming 12-08-2010
1,313
Posted By saman_glorious
more help on gossip implementation plz
but i have no idea how you guessed the problem! anyway
I would thank if send me your running code as it seems you already run the program
Forum: Programming 12-04-2010
1,313
Posted By saman_glorious
infinite loop, synchronizing gossip-based method
the following code runs, but it hangs somewhere, i don't know why,


#include<iostream>
#include<vector>
#include<cstdlib>
#include<ctime>
#include<list>
#include<pthread.h>...
Forum: Programming 12-03-2010
2,374
Posted By saman_glorious
I am so sorry i just noticed you asked me the...
I am so sorry i just noticed you asked me the compilable code.

I am writing the code for a single file, i can't directly store an integer in a file as it wouldn't be readable, i have to use...
Forum: Programming 12-03-2010
2,374
Posted By saman_glorious
#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP |...
#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)

my OS is Linux Ubuntu
Forum: Programming 12-03-2010
2,374
Posted By saman_glorious
how can i correct it?, even when i write values...
how can i correct it?, even when i write values to the file, i cannot open it manually, it says it not readable
this time when wanna start reading, the open() returns -1


for(int i = 1; i <=...
Forum: Programming 12-03-2010
2,374
Posted By saman_glorious
unexpected values received when writing and reading from file
In the code below i try to write and read from a file, but i get unexpected results, like after writing i cannot open the file, and when reading the file the value entered earlier is not shown

...
Forum: Programming 12-03-2010
4,395
Posted By saman_glorious
writing to file is not readable by user
In the following code segment I write to some file using , but this write is not readable by me when i open the file. any helps would be thankful.


#include<stdio.h>
#include<stdlib.h>...
17,270
Posted By saman_glorious
I found the problem, I was giving some space...
I found the problem, I was giving some space here:

typeset k = 1

which is illegal, now that i correct it, it works fine.

typeset k=1


---------- Post updated at 09:45 PM ----------...
Forum: Programming 09-01-2010
4,580
Posted By saman_glorious
i cannot go inside child process
I just want to create n number of childs and after each child would start executing some instruction, but when i execute the program i don't receive anything, I wonder how you get the result.
my...
17,270
Posted By saman_glorious
echo prints nothing
#!/bin/sh
k=1
echo $k

1#!/bin/sh
typeset k=1
echo $k

I tried them but I receive error:
split.sh: line 4: typeset: `=': not a valid identifier
split.sh: line 4: typeset: `1': not a valid...
17,270
Posted By saman_glorious
echo prints nothing-shell script
could anyone tell me why when i execute the following script, echo returns blank

set k = 1
echo $k
Forum: Programming 09-01-2010
4,580
Posted By saman_glorious
I tried it both on CentOS 5.2 and Ubuntu plz...
I tried it both on CentOS 5.2 and Ubuntu

plz have a look at my code again

for(int count = 0; count < nIntClientCount; count++)
{
pid_t pid;

if((pid = fork()) < 0){
...
1,682
Posted By saman_glorious
renaming files in a folder
I splited a file into parts, then i wrote a script to convert the format of the file names to this: part1.dat part2.dat
but I wonder why part.dat is also created knowing that the k variable starts...
Forum: Programming 09-01-2010
4,580
Posted By saman_glorious
fflush(stdout) does not even help
I did but again i get the same result, printf does not print anything and i don't know what happens to the childs...

[root@localhost Randomized Dissemination]# ./a.out
downloader peers randomly...
Forum: Programming 09-01-2010
4,580
Posted By saman_glorious
IPC-using fork() in a loop
I need to write a program which creates some n number of processes first and also creates a fifo for each of them, then it connects to the server and..

I tried creating these processes with fork()...
Forum: Programming 08-28-2010
0
2,028
Posted By saman_glorious
fifo
Dear friends
i'm want to implement a program which one file is split into fragments by the server (by some random size) and sent to some processes, so these processes get randomly the fragments of...
Forum: Programming 08-28-2010
4,271
Posted By saman_glorious
I think the way the variables are declared could...
I think the way the variables are declared could have influence on what you get.
like:
int a, b, c
is different from
int a;
int b;
-----
here you store all variables sequencially on the...
Showing results 1 to 20 of 20

 
All times are GMT -4. The time now is 06:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy