Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Binary Tree Creation Using fork() Post 302143684 by learneros on Friday 2nd of November 2007 02:55:44 PM
Old 11-02-2007
Binary Tree Creation Using fork()

Hi,
I am working on a program and kind of a stuck,nt getting it done.
"The program should take one command line arguments: number of hierarchy level. The

hierarchy of your program should of that level and each node have two child processes."
Can anyone give me the C code using fork() of this program.Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating breadth traversal binary tree

I almost have the entire script written. however the problem is how would i assign the global variable to terminate the process from the bottom up to ensure the child terminates so the parent can. ex. I am proccess 1 I am proccess 2 etc Here is the code $ cat tree.c ... (3 Replies)
Discussion started by: slurpeyatari
3 Replies

2. Solaris

compiled binary file gives "cannot execute binary file"

Hi, I have two Solaris machines. 1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500 2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60 I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Discussion started by: scgupta
0 Replies

3. Shell Programming and Scripting

Create a binary tree

I need to create a binary tree like structure of directories using shell script... does anyone know of any algorithm for this ? i tried doing a recursive algorithm function CreateDir { level=$1 dirname=$2 mkdir $dirname/sub1/ mkdir $dirname/sub2/ let level=level-1 ... (2 Replies)
Discussion started by: macvijay1985
2 Replies

4. Programming

tree creation for an expression

i have written a program for creating an infix tree for the given expression. the program is working fine if we give the expression completlely binded with operators and operands but when we ignore the brackets we need to consider the priority of the operators nad build the tree. i am not... (1 Reply)
Discussion started by: MrUser
1 Replies

5. Programming

Binary Tree

I have just been researching this topic and I was wondering what type of application might a binary tree be used for. For instance what type of application would be a good showcase for a binary tree that I could write as an example? (5 Replies)
Discussion started by: sepoto
5 Replies

6. Programming

Binary Search Tree Search problem

I am writing code for a binary search tree search and when I compile it i am getting strange errors such as, " /tmp/ccJ4X8Xu.o: In function `btree::btree()': project1.cpp:(.text+0x0): multiple definition of `btree::btree()' " What does that mean exactly? tree.h #ifndef TREE_H #define... (1 Reply)
Discussion started by: meredith1990
1 Replies

7. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

8. Programming

Binary search tree questions. Please help =)

I have some questions about certain placement of child nodes since I'm just learning BSTs and it's quite confusing even after reading some sources and doing some online insertion applets. Let's say I want to add nodes 5,7,3,4 to an empty basic BST. ... (1 Reply)
Discussion started by: Jill Ceke
1 Replies

9. UNIX for Dummies Questions & Answers

Unable to find files, those can be present anywhere in the directory tree,based on its creation date

Hi I am unable to find files, those are present anywhere in the same directory tree, based on the creation date. I need to find the files with their path, as I need to create them in another location and move them. I need some help with a script that may do the job. Please help (2 Replies)
Discussion started by: sam192837465
2 Replies

10. Web Development

Problem in printing binary tree using php and mysql

Database Structure Root Table ID Root_ Node Level 1 A 0 2 B 1 3 C 1 Child Table ID Left_Node Right_Node Root_Node Root_ID 1 B C A 1 ... (1 Reply)
Discussion started by: Deepak Tiwari
1 Replies
HWLOC-DISTRIB(1)						       hwloc							  HWLOC-DISTRIB(1)

NAME
hwloc-distrib - Build a number of cpu masks distributed on the system SYNOPSIS
hwloc-distrib [options] <integer> OPTIONS
--single Singlify each output to a single CPU. --taskset Show CPU set strings in the format recognized by the taskset command-line program instead of hwloc-specific CPU set string format. -v Verbose messages. -i <file>, --input <file> Read topology from XML file <file> (instead of discovering the topology on the local machine). If <file> is "-", the standard input is used. XML support must have been compiled in to hwloc for this option to be usable. -i <directory>, --input <directory> Read topology from the chroot specified by <directory> (instead of discovering the topology on the local machine). This option is generally only available on Linux. The chroot was usually created by gathering another machine topology with hwloc-gather-topology. -i <specification>, --input <specification> Simulate a fake hierarchy (instead of discovering the topology on the local machine). If <specification> is "node:2 pu:3", the topology will contain two NUMA nodes with 3 processing units in each of them. The <specification> string must end with a number of PUs. --if <format>, --input-format <format> Enforce the input in the given format, among xml, fsroot and synthetic. --ignore <type> Ignore all objects of type <type> in the topology. --from <type> Distribute starting from objects of the given type instead of from the top of the topology hierarchy, i.e. ignoring the structure given by objects above. --top <type> Distribute down to objects of the given type instead of down to the bottom of the topology hierarchy, i.e. ignoring the structure given by objects below. This may be useful if some latitude is desired for the binding, e.g. just bind on sockets and not to pre- cise cores or caches. --at <type> Distribute among objects of the given type. This is equivalent to specifying both --from and --to at the same time. --restrict <cpuset> Restrict the topology to the given cpuset. --version Report version and exit. DESCRIPTION
hwloc-distrib generates a series of CPU masks corresponding to a distribution of a given number of elements over the topology of the machine. The distribution is done recursively from the top of the hierarchy (or from the level specified by option --from) down to the bot- tom of the hierarchy (or down to the level specified by option --to, or until only one element remains), splitting the number of elements at each encountered hierarchy level not ignored by options --ignore. This can e.g. be used to distribute a set of processes hierarchically according to the topology of a machine. These masks can be used with hwloc-bind(1). NOTE: It is highly recommended that you read the hwloc(7) overview page before reading this man page. Most of the concepts described in hwloc(7) directly apply to the hwloc-bind utility. EXAMPLES
hwloc-distrib's operation is best described through several examples. If 4 processes have to be distributed across a machine, their CPU masks may be obtained with: $ hwloc-distrib 4 0x0000000f 0x00000f00 0x000000f0 0x0000f000 To distribute only among the second socket, the topology should be restricted: $ hwloc-distrib --restrict $(hwloc-calc socket:1) 4 0x00000010 0x00000020 0x00000040 0x00000080 To get a single processor of each CPU masks (prevent migration in case of binding) $ hwloc-distrib 4 --single 0x00000001 0x00000100 0x00000010 0x00001000 Each output line may be converted independently with hwloc-calc: $ hwloc-distrib 4 --single | hwloc-calc --taskset 0x1 0x100 0x10 0x1000 To convert the output into a list of processors that may be passed to dplace -c inside a mpirun command line: $ hwloc-distrib 4 --single | xargs hwloc-calc --pulist 0,8,4,16 RETURN VALUE
Upon successful execution, hwloc-distrib displays one or more CPU mask strings. The return value is 0. hwloc-distrib will return nonzero if any kind of error occurs, such as (but not limited to) failure to parse the command line. SEE ALSO
hwloc(7), hwloc-gather-topology(1) 1.4.1 Feb 27, 2012 HWLOC-DISTRIB(1)
All times are GMT -4. The time now is 01:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy