Sheet1Organizational Change ChartSelect one for each
categoryNotes (suggested action for improvement)Vision:To
Separate the Real from the Imagined Through Flight
[1 - no knowledge, 5 - know it well].)
12345NASA as explorers and innovators in the world needed to
expand space frontiers and improve quality of life on Earth by
through investment in space for human use to benefit the whole
world.Mission: Advancing Technology and Science Through
Flight.
[1 - no knowledge, 5 - know it well].)
)
12345 Development of space for commercial use by humans ,
participation and partnering with other countries to advance
knowledge of science in understanding the Earth, moon and the
general Universe .Purpose: The purpose of NASA organisation
is to explore space and Earth to improve the quality of life .[1 -
no knowledge, 5 - know it well].)
12345The purpose of NASA is well known. NASA should invest
more in space and constantly provide updates on any emerging
issues.Values: The core values of NASA organization includes
Safety,integrity,teamwork and Excellence. Rate the employee
knowledge of the organizational Values [1 - no knowledge, 5 -
know it well].)
12345The core values of NASA are somehow known though
safety needed to improved in execution of NASA missions
.Diversity:NASA organization partnered with other industries to
execute its objectives, also encouraged diverse people to persue
careers in STEM so that they help them to achieve their goals. [
1- no diverse at all, 5 - highly diverse].)12345NASA
organization is very diverse. More industries should be
encouraged to partner with NASA to support in finance and
other knowledge .Inclusion: (Rate the overall involvement of
the diverse groups in all the decision making and process for
change [ 1- no involvement at all, 5 - highly involved])
12345The diverse groups were more involved in decision
making and process of change. Inclusion of groups needed to be
considered in every stage of decision making and process of
change to build a competitive advantage.Goal: NASA set the
following goals :-NASA will be leaders in space exploration
and science. Develop and exchange technologies in space and
aeronautics. To establish presence of human in space.
12345some of the strategies were successful though some
actions about yhe return of humans from the moon and mars was
a challenge and needed to be improved for safety
measures.Strategy: strategies used by NASA included Mission
to understanding of Earth and human impact on earth's
environment,Aeronautics and Space Technology,
Human Exploration and Development of Space and science of
space
Space Science; [ 1 - very poor strategies, 5 very successful
strategies] )
12345Organizational safety needed to be improved for these
strategies to executed well by NASA as the leaders in aeronatics
and space science.Communication: NASA organization is a
scientific and technical agency which is committed openness in
communication in media and general public that recognizes
free ideas exchange and information .
(b) , NASA will create awareness about its activities and the
findings.
(c) NASA will ensure information is provided to users on time.
(d) NASA employees could channel their feedback to the
management even to press for readdress.
( [ 1 - very poor communication, 5 very successful
communication] )
12345communication means about organizational change were
some how successful through the workforce were required to
support changes in the organization. Proper communication
needed to be developed for these organizational changes to be
successful.Considering the above goal for organizational change
and the existing organizational culture,
rate Kotter's 8-Steps to Change, on a scale of 1 (did not
observe) to 5 (highley observed) during the implemented
proccesKotter's 8-Steps to ChangeSelect one for each StepNotes
(suggested action for improving the process)1Step OneAfter the
accident of NASA crew in shuttle there was need to ensure
organizational safety since there was insufficient requirement of
returning to Earth.12345The columbia accident which included
NASA crew created urgency for safety. Oversight team was
formed to investigate on issues and recommend on the possible
solutions.2Step TwoThe leaders deliberated on the need to
foster organizational safety and influenced by creating proper
methods of communication safety issues and heath
hazards.12345 The selected leaders in NASA communicated the
need to improve organizational safety to the management and
the need to address it was established for the NASA to remain
as Leaders in space science.3Step ThreeNASA set core values
such safety,teamwork and technological excellence to guide the
employees in any activity they do.ted 2345The organizational
safety,teamworkand excellence was aligned in the vision of
NASA to build a competitive advantage among other related
industries .4Step FourTo communicate vision NASA stressed on
measures to address all safety issues by allowing its employees
to report any issue on safety and provided basic training about
organizational safety.12345policies to communicate vision
needed to be formulated by management to improve the process.
Feedback from employess should be highly considered. Leaders
should communicate vision by acting as role models in daily
activities.5Step FiveNASA encouraged a culture of
organizational safety and ensured every employee understand its
important.12345Barriers that obstract change should be
removed immediately for organizational change. Proper
requirements of return of humans from the moon should be
assured be sending humans to carry a research there.6Step
SixNASA team planned for a mission to the moon which was
carried out successfully.12345A mission to the moon was
carried out successfully .7Step SevenNASA set goals to achieve
which included developing and exchanging technologies in
space and aeronautics, establishing presence of human in
space.12345The organizational safety culture was build which
aided in carrying out successful mission to the moon among
other in space for betterment of human life.8Step EightNASA
recognizes the crew that made a successful mission to the
moon.12345Members of the organization that contributed to the
success of mission need to be rewarded and remembered by old
and new members in the organization..
Your program should accept a command line: <program name>
(-tx -ny | -p) {-f filename} i
Where x = 1 or 2. If x=1 run a threaded merge sort algorithm. If
x=2 run your spinlock test, n =
the number of threads, 1-4. i is the number of messages each
thread will output.
If -p is given, the program will prompt the user for test 1 or 2,
and the number of threads if 2 is
selected.
If -f filename is given a file, named filename, is opened and the
report is written to filename. If -f
filename is not given the report should be written to stdout.
If anything else is input (including if a -n value is given when x
= 1), output the following usage
statement:
Usage: <program name> ( -tx {-ny}| -p ){-f filename} i
And exit the program. I would recommend creating a helper
function to validate the inputs.
If the -p option is given and the user enters anything besides a 1
or a 2, output an error
message and exit. If 2 is selected, prompt for the number of
threads, 1-4. Again, exit if anything
is entered besides 1, 2, 3 or 4.
Your spinlock test will run 1-4 pthreads, which will be while(1)
loops testing a value, which never
changes. Periodically, each thread will send a string to the
wBUF(.) function in shmem, which
will time- stamp and store the messages. When cuBuf(.) is
called, an informative report is output
to stdout or to a file (I am intentionally leaving you a lot of
leeway here). At the very least your
program should output each time-stamped message in the order
sent to the shbuf object with at
least one summary line at the end, providing some useful
information about the test run.
At this point, the program should exit.
In order to prevent thread conflict only one thread may enter the
shmem object’ functions at a
time. You should protect access to shmem’s functions with a
semaphore (sem.h and sem.c
supplied).
DO NOT FORGET TO REMOVE YOUR SEMAPHORE WITH
THE ipcrm COMMAND.
#include "mopt.h"
#include <stdio.h>
#include <stdlib.h>
//
// Fairleigh Dickinson University
// CSCIxxxx <semester><year>
// Programming Assignment x
//
// Description:
//
//
void * const getVals(const int argc, const char ** argv);
main(const int argc, const char ** argv)
{
void * const v = getVals(argc, argv);
//
// Output.
//
{
char ch;
for (ch = 'a'; ch <= 'z'; ch++)
if (optExist(ch,v)+1)
{
const char * const pM =
getArg(ch,v);
printf("opt %c found",ch);
if (pM) printf
(" parm = %s",pM);
printf ("n");
}
}
//
// Get the ending
// parameter.
//
{
const char * const pm = aVI(v);
printf ("Parm = %sn", pm);
}
//
// Free the
// memory
//
moptFree (v);
}
void * const getVals(const int argc, const char ** argv)
{
//
// Initialize.
//
void * const v = initialize();
//
// Set expected
// options and
// if a parameter
// is expected.
//
setO ('a', 0, v);
setO ('b', 0, v);
setO ('g', 0, v);
setO ('r', 1, v);
setO ('s', 1, v);
{
//
// Parse the
// command line.
//
const int pI = parse(argc,argv,v);
if(pI == -1)
{
printf ("Parse failed!n");
exit (0);
}
return v;
}
}
#include "mopt.h"
#include <stdlib.h>
#include "getopt.h"
//
// Fairleigh Dickinson University
// CSCIxxxx <semester><year>
// Programming Assignment x
//
// Description:
//
//
enum {TABLESIZE = 257};
typedef struct
{
char m[TABLESIZE];
const char * p[TABLESIZE];
int tLen;
char oS[2*TABLESIZE];
int oLen;
char * pC;
} mType;
void * initialize()
{
const int sL = sizeof(mType);
void * mP = calloc(sL,1);
return mP;
}
static void addOptP(const char c, const char * const s, void * p)
{
if (optExist(c,p) != 1)
{
mType * const mP = (mType * const)p;
int i = mP->tLen;
mP->m[i] = c;
mP->p[i++] = s;
mP->tLen = i;
}
}
const int setO(const char c, const int e, void * p)
{
mType * const mP = (mType * const)p;
int i = mP->oLen;
mP->oS[i++] = c;
if (e) mP->oS[i++] = ':';
mP->oLen = i;
return 1;
}
const char * const getArg(const char c, void * p)
{
const int i = optExist(c,p);
if (i>=0)
{
mType * const mP =(mType * const)p;
const char * pA = mP->p[i];
return pA;
}
return 0;
}
const sType parse
(
const int argc,
const char * const * const argv,
void *p
)
{
extern int optind;
extern int optopt;
extern char * optarg;
extern int opterr;
mType * const mP = (mType * const)p;
const char * const optstring = mP->oS;
char c;
//
// Set opterr
// to 0 to prevent
// getopt from
// printing
// messages.
//
opterr = 0;
c = getopt(argc,argv,optstring);
do
{
if (c=='?') return MOPT_ERROR;
if (optExist(c,p) != -1)
return MOPT_ERROR;
addOptP (c,optarg,mP);
c = getopt(argc, argv, optstring);
} while (c+1);
mP->pC = (char *)argv[optind];
return MOPT_PARSEOK;
}
const char * const aVI(void * p)
{
mType * const mP = (mType * const)p;
const char * const t = mP->pC;
return t;
}
const int optExist(const char c, void * p)
{
if (p)
{
const mType * const mP = (mType*)p;
const char * r =
(const char *)mP->m;
int i = 0;
while(r[i])
if (c==r[i]) return i;
else ++i;
}
return -1;
}
const sType moptFree(void * p)
{
if (p) free(p);
p = 0;
return MOPT_CLEAR;
}
/*
** Program 4 -- W Phillips 04705804
** CSE 7343 Summer 2006
**
** This program was compiled and run on neo.engr.smu.edu
** and on fermi.engr.smu.edu.
**
**
** To compile and run:
** cc -pthread -o prog4 prog4.c
** ./prog4 <parm> Any parm provided results in quicksort
** being used. Otherwise shellsort is used.
** The value you are prompted for is n --
** the size of the small array.
*/
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "shbuf.h"
/*
** On most Linux machines you can go up
** to ten million.
*/
enum { MAXARRAYSIZE = 30000000 };
enum { MAX2ARRAYSIZE = MAXARRAYSIZE*2 };
enum { MAXLINE = 20 };
enum { PROMPTSIZE = 80 };
/*
** Change this to 0 to dump the contents
** of the sorted arrays. I would
** recommend keeping n small if you do
** this.
*/
enum { DUMPINHIBIT = 1 };
/*
** Instead of mallocing I decided to just make
** the arrays the max size which is what we'd
** have to do in the max case anyway. For
** multiple runs I figured this would work out
** better instead of doing all the dynamic
** allocations and frees. It could make for
** a fairer test.
*/
int smallArray1[MAXARRAYSIZE];
int smallArray2[MAXARRAYSIZE];
int smallArray3[MAXARRAYSIZE];
int smallArray4[MAXARRAYSIZE];
int largeArray1[MAX2ARRAYSIZE];
int largeArray2[MAX2ARRAYSIZE];
int largeArray3[MAX2ARRAYSIZE];
/*
** This parameter gets set to 1 if the user
** enters any parameter when this program is
** run. If that is the case, quicksort is
** used instead of shell sort.
*/
int useQsort = 0;
const double mS_PER_SEC = 1000000.0;
/*
** This is the quicksort algorithm. Since all intermediate
** variables are defined locally (on the stack) it is thread-
** safe.
**
*/
int partition(int * const a, const int l, const int r, const char * s)
{
const int pivot = a[l];
int i = l;
int j = r+1;
int t;
while(1)
{
wBUF("A Q message");
wBUF(s);
wBUF("n");
do ++i; while((a[i]<=pivot) && (i<=r));
do --j; while(a[j]>pivot );
if(i>=j) break;
t = a[i];
a[i] = a[j];
a[j] = t;
}
t = a[l];
a[l] = a[j];
a[j] = t;
return j;
}
void qSortArray(int * const a, const int l, const int r, const char
* s)
{
if( l < r )
{
const int j = partition( a, l, r, s );
qSortArray(a,l, j-1, s );
qSortArray(a,j+1,r , s );
}
}
/*
** END QUICKSORT ALOGORITHM
*/
/*
** This is the shellsort algorithm.
*/
void shellSortPhase(int * const a, const int length, const int
gap)
{
int i;
for (i=gap; i<length; ++i)
{
wBUF("An S messagen");
const int value = a[i];
int j;
for (j = i - gap; j >= 0 && a[j] > value; j -= gap)
a[j + gap] = a[j];
a[j + gap] = value;
}
}
void sSortArray(int * const a, const size_t length, const char *
s)
{
/*
* gaps[] should approximate a geometric progression.
* The following sequence is the best known in terms of
* the average number of key comparisons made [2]
*/
static const int gaps[] = { 1, 4, 10, 23, 57, 132, 301, 701 };
int sizeIndex;
for
(
sizeIndex = sizeof(gaps)/sizeof(gaps[0]) - 1;
sizeIndex >= 0;
--sizeIndex
)
shellSortPhase(a,length,gaps[sizeIndex]);
}
/*
** END SHELL SORT ALGORITHM
*/
/*
** This structure is passed between the thread
** invocation and the sort algorithm.
*/
typedef struct
{
int * const a;
const int s;
const char tc[2];
} sortParmType;
/*
** Single exit point.
*/
void cleanExit()
{
pthread_exit(NULL);
}
/*
** This is a wrapper that translates the void *
** parameter we are allowed into meaningful values.
** Those values (array and array size) are passed
** to the selected sort function.
*/
void * sortWrapper(void * x)
{
sortParmType * const S = (sortParmType * const)x;
if (S->a != 0)
/*
** Perform shell or quicksort.
*/
if (useQsort) qSortArray (S->a,0, (S->s)-1, S->tc);
else sSortArray (S->a,S->s , S->tc);
cleanExit();
return (void *)0; /* never executes -- eliminates */
/* compiler warnings */
}
/*
** This function gets the array size from the
** user.
*/
const long getArraySize(const char * const p)
{
char line[MAXLINE];
const int j = fputs(p, stdout);
const char * const c = fgets(line, MAXLINE, stdin);
const long s = (long) atof(line);
if ((s<=0) || (s>MAXARRAYSIZE))
{
if (useQsort) printf("Quicksort Usedn");
else printf("Shellsort Usedn");
cleanExit();
}
return s;
}
/*
** This function copies one array to another.
*/
void copyArray
(int * const a, const int * const b, const int arrSize)
{
int i;
for (i=0; i<arrSize; ++i) a[i] = b[i];
}
/*
** This function merges two equal sized arrays (aTargSize/2)
into
** an array double the size (aTargSize).
*/
void mergeArrays
(
int * const aTarg,
const int * const a1,
const int * const a2,
const int aTargSize)
{
int iTarg = 0;
int i1 = 0;
int i2 = 0;
const int aInSize = aTargSize/2;
do
{
if (i1 == aInSize)
aTarg[iTarg++] = a2[i2++];
else if (i2 == aInSize)
aTarg[iTarg++] = a1[i1++];
else if (a1[i1] < a2[i2])
aTarg[iTarg++] = a1[i1++];
else
aTarg[iTarg++] = a2[i2++];
} while (iTarg<aTargSize);
}
/*
** Error in spawning thread? Exit.
*/
void sThreadError(const int t)
{
if(t) printf("Error spawning Thread 1n");
else printf("Error spawning Thread 2n");
cleanExit();
}
/*
** Error in joining thread? Exit.
*/
void jThreadError(const int t)
{
if(t) printf("Error joining Thread 1n");
else printf("Error joining Thread 2n");
cleanExit();
}
/*
** This function joins the threads.
*/
void joinThreads
(
const pthread_t t1,
const pthread_t t2
)
{
int *s;
if (t1 != 0)
if (pthread_join(t1,(void **)&s)) jThreadError(0);
if (t2 != 0)
if (pthread_join(t2,(void **)&s)) jThreadError(1);
}
/*
** This function performs the sequential sort by
** direct invocation.
*/
void sequentialSort(int * const a, const int arrSize)
{
if (useQsort) qSortArray (a,0, arrSize-1,"0");
else sSortArray (a,arrSize ,"0");
}
/*
** If either of the array pointers are = 0, that array won't be
** sorted. However, in this program 2 arrays are always sorted
** but I did test the other option.
*/
void threadedSort
(
int * const a1in,
int * const a2in,
const int arrSize
)
{
const sortParmType S1 = {a1in,arrSize,"1"};
const sortParmType S2 = {a2in,arrSize,"2"};
pthread_t t1 = 0;
pthread_t t2 = 0;
/*
** Set thread detatched attribute.
*/
// pthread_attr_t attr;
// pthread_attr_init(&attr);
//
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_JOINA
BLE);
if (a1in != 0)
{
const int rc =
pthread_create(&t1,NULL,sortWrapper,(void *)(&S1));
if (rc) sThreadError(0);
}
if (a2in != 0)
{
const int rc =
pthread_create(&t2,NULL,sortWrapper,(void *)(&S2));
if (rc) sThreadError(1);
}
joinThreads(t1,t2);
// pthread_attr_destroy(&attr);
}
/*
** This function verifies that two arrays are equal and
** in ascending sorted order. Returns 1 if OK, otherwise 0.
*/
int verifyArrays
(
const int * const a1in,
const int * const a2in,
const int arrSize
)
{
int i;
const int u = arrSize-1;
for (i=0; i<arrSize; ++i)
{
if (a1in[i] != a2in[i]) return 0;
if ((i<u) && (a1in[i] > a1in[i+1])) return 0;
}
return 1;
}
/*
** This function outputs an array to stdout as long
** as DUMPINHIBIT is not equal to zero.
*/
void dumpArray
(
const char * const t,
const int * const a,
const int arrSize
)
{
if (DUMPINHIBIT) return;
int i;
printf("n"); printf(t); printf("n");
for (i=0; i<arrSize; printf(" %dn", a[i++]));
}
/*
** This function fills an array with values
** ranging from 0 to RAND_MAX.
*/
void fillArray(int * const a, const int arrSize)
{
int i;
for (i=0; i<arrSize; ++i) a[i] = rand();
}
int main(const int argc, char * const argv[])
{
/*
** Build the prompt so it will adjust if MAXARRAYSIZE
** is changed.
*/
char prompt[PROMPTSIZE];
sprintf
(
prompt,
"nEnter array size: 1 -- %d or anything else to quit >>
",
MAXARRAYSIZE
);
/*
** Constant used in time computation
*/
const double mS_PER_CLOCK =
mS_PER_SEC/CLOCKS_PER_SEC;
/*
** If the user supplies any argument, use quicksort.
*/
if(argc>1) useQsort = 1;
while(1)
{
const int as = getArraySize(prompt);
const int as2 = as*2;
clock_t t1,t2;
/*
** Populate the test arrays. Steps 1,2, and 3
*/
fillArray(smallArray1,as);
fillArray(smallArray2,as);
copyArray(smallArray3,smallArray1,as);
copyArray(smallArray4,smallArray2,as);
copyArray(largeArray3,smallArray1,as);
copyArray(&largeArray3[as],smallArray2,as);
/*
** Run the first test case (2 sorts and a merge) Step 4
*/
initBUF();
t1 = clock();
threadedSort(smallArray1,smallArray2,as);
mergeArrays(largeArray1,smallArray1,smallArray2,as2);
t2 = clock();
cuBUF();
dumpArray("largeArray1:",largeArray1,as2);
printf("Time to do 2 thread sorts and a merge =
%f",
(double)(t2-t1) * mS_PER_CLOCK);
printf(" microsecondsn");
return;
/*
** Run the second test case (2 sorts, copy &merge) Step 5
*/
t1 = clock();
sequentialSort(smallArray3,as);
sequentialSort(smallArray4,as);
mergeArrays(largeArray2,smallArray3,smallArray4,as2);
t2 = clock();
dumpArray("largeArray2:",largeArray2,as2);
printf("Time to do 2 sequential sorts and a merge =
%f",
(double)(t2-t1) * mS_PER_CLOCK);
printf(" microsecondsn");
/*
** Run the third test case (single sort) Step 6
*/
t1 = clock();
sequentialSort(largeArray3,as2);
t2 = clock();
dumpArray("largeArray3:",largeArray3,as2);
printf("Time to do a sequential sort on a combined array =
%f",
(double)(t2-t1) * mS_PER_CLOCK);
printf(" microsecondsn");
/*
** As a sanity check, ensure the arrays are
** equal and in sorted order.
*/
if((verifyArrays(largeArray1,largeArray2,as2) == 0) ||
(verifyArrays(largeArray1,largeArray3,as2) == 0))
printf("Error in sort algorithm!!!!n");
}
cleanExit();
return 0;
}
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include "sem.h"
typedef struct sem_ds sDType;
typedef struct seminfo sIType;
typedef struct sembuf sBType;
typedef union
{
int val;
sDType *buf;
const unsigned
short int *array;
sIType *__buf;
} sUType;
typedef struct
{
sUType arg;
sBType zero;
sBType lock;
sBType unlock;
long sID;
pid_t pID;
} iNType;
static void setSB
(
sBType * const s,
const int sN,
const int sO,
const int sF
)
{
s->sem_num = sN;
s->sem_op = sO;
s->sem_flg = sF;
}
void initSEM
(
void * const v,
const long k
)
{
const long kY = k;
iNType *const iP =
(iNType* const)v;
sBType *const sZ =
&iP->zero;
sBType *const sL =
&iP->lock;
sBType *const sU =
&iP->unlock;
setSB
(sZ,0,0,SEM_UNDO);
setSB
(sL,0,-1,SEM_UNDO);
setSB
(sU,0,1,SEM_UNDO);
iP->pID = getpid();
iP->sID =
semget(kY,1,
IPC_CREAT|
IPC_EXCL|
0666);
if(iP->sID == -1)
iP->sID =
semget (kY,1,0);
setSEM (0,v);
}
const int getSSizeSEM()
{
const int s =
sizeof(iNType);
return s;
}
const int pSEM
(
void * const v
)
{
iNType *const iP =
(iNType* const)v;
const int sid =
iP->sID;
sBType *const sL =
&iP->lock;
const int eC =
semop(sid, sL, 1);
return eC;
}
const int setSEM
(
const int x,
void * const v
)
{
iNType *const iP =
(iNType* const)v;
const int sid =
iP->sID;
semctl
(sid,0,SETVAL, x);
}
void vSEM
(
void * const v
)
{
iNType *const iP =
(iNType* const)v;
const int sid =
iP->sID;
sBType *const sU =
&iP->unlock;
semop (sid, sU, 1);
}
void zSEM
(
void * const v
)
{
iNType *const iP =
(iNType* const)v;
const int sid =
iP->sID;
sBType *const sZ =
&iP->zero;
semop (sid, sZ, 1);
}
void dSEM
(
void * const v
)
{
iNType *const iP =
(iNType* const)v;
const int p1 =
getpid();
const int p2 =
iP->pID;
const long p3 =
iP->sID;
if(p1==p2)
semctl(p3,0,
IPC_RMID,0);
}
#include "shbuf.h"
#include <stdio.h>
int initBUF() {return 0;}
//
// Write to buffer.
//
int wBUF( const char * const s )
{
printf(s);
return 0;
}
//
// Clean up.
//
int cuBUF() {return 0;}
Sheet1Organizational Change ChartSelect one for each categoryNotes.docx

Sheet1Organizational Change ChartSelect one for each categoryNotes.docx

  • 1.
    Sheet1Organizational Change ChartSelectone for each categoryNotes (suggested action for improvement)Vision:To Separate the Real from the Imagined Through Flight [1 - no knowledge, 5 - know it well].) 12345NASA as explorers and innovators in the world needed to expand space frontiers and improve quality of life on Earth by through investment in space for human use to benefit the whole world.Mission: Advancing Technology and Science Through Flight. [1 - no knowledge, 5 - know it well].) ) 12345 Development of space for commercial use by humans , participation and partnering with other countries to advance knowledge of science in understanding the Earth, moon and the general Universe .Purpose: The purpose of NASA organisation is to explore space and Earth to improve the quality of life .[1 - no knowledge, 5 - know it well].) 12345The purpose of NASA is well known. NASA should invest more in space and constantly provide updates on any emerging issues.Values: The core values of NASA organization includes Safety,integrity,teamwork and Excellence. Rate the employee knowledge of the organizational Values [1 - no knowledge, 5 - know it well].) 12345The core values of NASA are somehow known though safety needed to improved in execution of NASA missions .Diversity:NASA organization partnered with other industries to execute its objectives, also encouraged diverse people to persue careers in STEM so that they help them to achieve their goals. [ 1- no diverse at all, 5 - highly diverse].)12345NASA organization is very diverse. More industries should be
  • 2.
    encouraged to partnerwith NASA to support in finance and other knowledge .Inclusion: (Rate the overall involvement of the diverse groups in all the decision making and process for change [ 1- no involvement at all, 5 - highly involved]) 12345The diverse groups were more involved in decision making and process of change. Inclusion of groups needed to be considered in every stage of decision making and process of change to build a competitive advantage.Goal: NASA set the following goals :-NASA will be leaders in space exploration and science. Develop and exchange technologies in space and aeronautics. To establish presence of human in space. 12345some of the strategies were successful though some actions about yhe return of humans from the moon and mars was a challenge and needed to be improved for safety measures.Strategy: strategies used by NASA included Mission to understanding of Earth and human impact on earth's environment,Aeronautics and Space Technology, Human Exploration and Development of Space and science of space Space Science; [ 1 - very poor strategies, 5 very successful strategies] ) 12345Organizational safety needed to be improved for these strategies to executed well by NASA as the leaders in aeronatics and space science.Communication: NASA organization is a scientific and technical agency which is committed openness in communication in media and general public that recognizes free ideas exchange and information . (b) , NASA will create awareness about its activities and the findings. (c) NASA will ensure information is provided to users on time. (d) NASA employees could channel their feedback to the management even to press for readdress. ( [ 1 - very poor communication, 5 very successful communication] ) 12345communication means about organizational change were
  • 3.
    some how successfulthrough the workforce were required to support changes in the organization. Proper communication needed to be developed for these organizational changes to be successful.Considering the above goal for organizational change and the existing organizational culture, rate Kotter's 8-Steps to Change, on a scale of 1 (did not observe) to 5 (highley observed) during the implemented proccesKotter's 8-Steps to ChangeSelect one for each StepNotes (suggested action for improving the process)1Step OneAfter the accident of NASA crew in shuttle there was need to ensure organizational safety since there was insufficient requirement of returning to Earth.12345The columbia accident which included NASA crew created urgency for safety. Oversight team was formed to investigate on issues and recommend on the possible solutions.2Step TwoThe leaders deliberated on the need to foster organizational safety and influenced by creating proper methods of communication safety issues and heath hazards.12345 The selected leaders in NASA communicated the need to improve organizational safety to the management and the need to address it was established for the NASA to remain as Leaders in space science.3Step ThreeNASA set core values such safety,teamwork and technological excellence to guide the employees in any activity they do.ted 2345The organizational safety,teamworkand excellence was aligned in the vision of NASA to build a competitive advantage among other related industries .4Step FourTo communicate vision NASA stressed on measures to address all safety issues by allowing its employees to report any issue on safety and provided basic training about organizational safety.12345policies to communicate vision needed to be formulated by management to improve the process. Feedback from employess should be highly considered. Leaders should communicate vision by acting as role models in daily activities.5Step FiveNASA encouraged a culture of organizational safety and ensured every employee understand its important.12345Barriers that obstract change should be removed immediately for organizational change. Proper
  • 4.
    requirements of returnof humans from the moon should be assured be sending humans to carry a research there.6Step SixNASA team planned for a mission to the moon which was carried out successfully.12345A mission to the moon was carried out successfully .7Step SevenNASA set goals to achieve which included developing and exchanging technologies in space and aeronautics, establishing presence of human in space.12345The organizational safety culture was build which aided in carrying out successful mission to the moon among other in space for betterment of human life.8Step EightNASA recognizes the crew that made a successful mission to the moon.12345Members of the organization that contributed to the success of mission need to be rewarded and remembered by old and new members in the organization.. Your program should accept a command line: <program name> (-tx -ny | -p) {-f filename} i Where x = 1 or 2. If x=1 run a threaded merge sort algorithm. If x=2 run your spinlock test, n = the number of threads, 1-4. i is the number of messages each thread will output. If -p is given, the program will prompt the user for test 1 or 2, and the number of threads if 2 is selected. If -f filename is given a file, named filename, is opened and the report is written to filename. If -f filename is not given the report should be written to stdout. If anything else is input (including if a -n value is given when x = 1), output the following usage statement:
  • 5.
    Usage: <program name>( -tx {-ny}| -p ){-f filename} i And exit the program. I would recommend creating a helper function to validate the inputs. If the -p option is given and the user enters anything besides a 1 or a 2, output an error message and exit. If 2 is selected, prompt for the number of threads, 1-4. Again, exit if anything is entered besides 1, 2, 3 or 4. Your spinlock test will run 1-4 pthreads, which will be while(1) loops testing a value, which never changes. Periodically, each thread will send a string to the wBUF(.) function in shmem, which will time- stamp and store the messages. When cuBuf(.) is called, an informative report is output to stdout or to a file (I am intentionally leaving you a lot of leeway here). At the very least your program should output each time-stamped message in the order sent to the shbuf object with at least one summary line at the end, providing some useful information about the test run. At this point, the program should exit. In order to prevent thread conflict only one thread may enter the shmem object’ functions at a time. You should protect access to shmem’s functions with a semaphore (sem.h and sem.c supplied). DO NOT FORGET TO REMOVE YOUR SEMAPHORE WITH THE ipcrm COMMAND.
  • 6.
    #include "mopt.h" #include <stdio.h> #include<stdlib.h> // // Fairleigh Dickinson University // CSCIxxxx <semester><year> // Programming Assignment x // // Description: // // void * const getVals(const int argc, const char ** argv); main(const int argc, const char ** argv) {
  • 7.
    void * constv = getVals(argc, argv); // // Output. // { char ch; for (ch = 'a'; ch <= 'z'; ch++) if (optExist(ch,v)+1) { const char * const pM = getArg(ch,v); printf("opt %c found",ch); if (pM) printf (" parm = %s",pM); printf ("n"); }
  • 8.
    } // // Get theending // parameter. // { const char * const pm = aVI(v); printf ("Parm = %sn", pm); } // // Free the // memory // moptFree (v); }
  • 9.
    void * constgetVals(const int argc, const char ** argv) { // // Initialize. // void * const v = initialize(); // // Set expected // options and // if a parameter // is expected. // setO ('a', 0, v); setO ('b', 0, v); setO ('g', 0, v);
  • 10.
    setO ('r', 1,v); setO ('s', 1, v); { // // Parse the // command line. // const int pI = parse(argc,argv,v); if(pI == -1) { printf ("Parse failed!n"); exit (0); } return v; } }
  • 11.
    #include "mopt.h" #include <stdlib.h> #include"getopt.h" // // Fairleigh Dickinson University // CSCIxxxx <semester><year> // Programming Assignment x // // Description: // // enum {TABLESIZE = 257}; typedef struct { char m[TABLESIZE];
  • 12.
    const char *p[TABLESIZE]; int tLen; char oS[2*TABLESIZE]; int oLen; char * pC; } mType; void * initialize() { const int sL = sizeof(mType); void * mP = calloc(sL,1); return mP; } static void addOptP(const char c, const char * const s, void * p) { if (optExist(c,p) != 1) {
  • 13.
    mType * constmP = (mType * const)p; int i = mP->tLen; mP->m[i] = c; mP->p[i++] = s; mP->tLen = i; } } const int setO(const char c, const int e, void * p) { mType * const mP = (mType * const)p; int i = mP->oLen; mP->oS[i++] = c; if (e) mP->oS[i++] = ':'; mP->oLen = i; return 1; }
  • 14.
    const char *const getArg(const char c, void * p) { const int i = optExist(c,p); if (i>=0) { mType * const mP =(mType * const)p; const char * pA = mP->p[i]; return pA; } return 0; } const sType parse (
  • 15.
    const int argc, constchar * const * const argv, void *p ) { extern int optind; extern int optopt; extern char * optarg; extern int opterr; mType * const mP = (mType * const)p; const char * const optstring = mP->oS; char c; // // Set opterr // to 0 to prevent // getopt from
  • 16.
    // printing // messages. // opterr= 0; c = getopt(argc,argv,optstring); do { if (c=='?') return MOPT_ERROR; if (optExist(c,p) != -1) return MOPT_ERROR; addOptP (c,optarg,mP); c = getopt(argc, argv, optstring); } while (c+1); mP->pC = (char *)argv[optind]; return MOPT_PARSEOK; }
  • 17.
    const char *const aVI(void * p) { mType * const mP = (mType * const)p; const char * const t = mP->pC; return t; } const int optExist(const char c, void * p) { if (p) { const mType * const mP = (mType*)p; const char * r = (const char *)mP->m; int i = 0; while(r[i])
  • 18.
    if (c==r[i]) returni; else ++i; } return -1; } const sType moptFree(void * p) { if (p) free(p); p = 0; return MOPT_CLEAR; } /* ** Program 4 -- W Phillips 04705804 ** CSE 7343 Summer 2006 ** ** This program was compiled and run on neo.engr.smu.edu
  • 19.
    ** and onfermi.engr.smu.edu. ** ** ** To compile and run: ** cc -pthread -o prog4 prog4.c ** ./prog4 <parm> Any parm provided results in quicksort ** being used. Otherwise shellsort is used. ** The value you are prompted for is n -- ** the size of the small array. */ #include <pthread.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #include "shbuf.h" /*
  • 20.
    ** On mostLinux machines you can go up ** to ten million. */ enum { MAXARRAYSIZE = 30000000 }; enum { MAX2ARRAYSIZE = MAXARRAYSIZE*2 }; enum { MAXLINE = 20 }; enum { PROMPTSIZE = 80 }; /* ** Change this to 0 to dump the contents ** of the sorted arrays. I would ** recommend keeping n small if you do ** this. */ enum { DUMPINHIBIT = 1 }; /* ** Instead of mallocing I decided to just make
  • 21.
    ** the arraysthe max size which is what we'd ** have to do in the max case anyway. For ** multiple runs I figured this would work out ** better instead of doing all the dynamic ** allocations and frees. It could make for ** a fairer test. */ int smallArray1[MAXARRAYSIZE]; int smallArray2[MAXARRAYSIZE]; int smallArray3[MAXARRAYSIZE]; int smallArray4[MAXARRAYSIZE]; int largeArray1[MAX2ARRAYSIZE]; int largeArray2[MAX2ARRAYSIZE]; int largeArray3[MAX2ARRAYSIZE]; /* ** This parameter gets set to 1 if the user ** enters any parameter when this program is
  • 22.
    ** run. Ifthat is the case, quicksort is ** used instead of shell sort. */ int useQsort = 0; const double mS_PER_SEC = 1000000.0; /* ** This is the quicksort algorithm. Since all intermediate ** variables are defined locally (on the stack) it is thread- ** safe. ** */ int partition(int * const a, const int l, const int r, const char * s) { const int pivot = a[l]; int i = l; int j = r+1;
  • 23.
    int t; while(1) { wBUF("A Qmessage"); wBUF(s); wBUF("n"); do ++i; while((a[i]<=pivot) && (i<=r)); do --j; while(a[j]>pivot ); if(i>=j) break; t = a[i]; a[i] = a[j]; a[j] = t; } t = a[l]; a[l] = a[j]; a[j] = t; return j;
  • 24.
    } void qSortArray(int *const a, const int l, const int r, const char * s) { if( l < r ) { const int j = partition( a, l, r, s ); qSortArray(a,l, j-1, s ); qSortArray(a,j+1,r , s ); } } /* ** END QUICKSORT ALOGORITHM */ /* ** This is the shellsort algorithm.
  • 25.
    */ void shellSortPhase(int *const a, const int length, const int gap) { int i; for (i=gap; i<length; ++i) { wBUF("An S messagen"); const int value = a[i]; int j; for (j = i - gap; j >= 0 && a[j] > value; j -= gap) a[j + gap] = a[j]; a[j + gap] = value; } } void sSortArray(int * const a, const size_t length, const char * s) {
  • 26.
    /* * gaps[] shouldapproximate a geometric progression. * The following sequence is the best known in terms of * the average number of key comparisons made [2] */ static const int gaps[] = { 1, 4, 10, 23, 57, 132, 301, 701 }; int sizeIndex; for ( sizeIndex = sizeof(gaps)/sizeof(gaps[0]) - 1; sizeIndex >= 0; --sizeIndex ) shellSortPhase(a,length,gaps[sizeIndex]); } /* ** END SHELL SORT ALGORITHM
  • 27.
    */ /* ** This structureis passed between the thread ** invocation and the sort algorithm. */ typedef struct { int * const a; const int s; const char tc[2]; } sortParmType; /* ** Single exit point. */ void cleanExit()
  • 28.
    { pthread_exit(NULL); } /* ** This isa wrapper that translates the void * ** parameter we are allowed into meaningful values. ** Those values (array and array size) are passed ** to the selected sort function. */ void * sortWrapper(void * x) { sortParmType * const S = (sortParmType * const)x; if (S->a != 0) /* ** Perform shell or quicksort. */ if (useQsort) qSortArray (S->a,0, (S->s)-1, S->tc);
  • 29.
    else sSortArray (S->a,S->s, S->tc); cleanExit(); return (void *)0; /* never executes -- eliminates */ /* compiler warnings */ } /* ** This function gets the array size from the ** user. */ const long getArraySize(const char * const p) { char line[MAXLINE]; const int j = fputs(p, stdout); const char * const c = fgets(line, MAXLINE, stdin); const long s = (long) atof(line); if ((s<=0) || (s>MAXARRAYSIZE)) {
  • 30.
    if (useQsort) printf("QuicksortUsedn"); else printf("Shellsort Usedn"); cleanExit(); } return s; } /* ** This function copies one array to another. */ void copyArray (int * const a, const int * const b, const int arrSize) { int i; for (i=0; i<arrSize; ++i) a[i] = b[i]; } /*
  • 31.
    ** This functionmerges two equal sized arrays (aTargSize/2) into ** an array double the size (aTargSize). */ void mergeArrays ( int * const aTarg, const int * const a1, const int * const a2, const int aTargSize) { int iTarg = 0; int i1 = 0; int i2 = 0; const int aInSize = aTargSize/2; do
  • 32.
    { if (i1 ==aInSize) aTarg[iTarg++] = a2[i2++]; else if (i2 == aInSize) aTarg[iTarg++] = a1[i1++]; else if (a1[i1] < a2[i2]) aTarg[iTarg++] = a1[i1++]; else aTarg[iTarg++] = a2[i2++]; } while (iTarg<aTargSize); } /* ** Error in spawning thread? Exit. */ void sThreadError(const int t) { if(t) printf("Error spawning Thread 1n");
  • 33.
    else printf("Error spawningThread 2n"); cleanExit(); } /* ** Error in joining thread? Exit. */ void jThreadError(const int t) { if(t) printf("Error joining Thread 1n"); else printf("Error joining Thread 2n"); cleanExit(); } /* ** This function joins the threads. */ void joinThreads
  • 34.
    ( const pthread_t t1, constpthread_t t2 ) { int *s; if (t1 != 0) if (pthread_join(t1,(void **)&s)) jThreadError(0); if (t2 != 0) if (pthread_join(t2,(void **)&s)) jThreadError(1); } /* ** This function performs the sequential sort by ** direct invocation. */ void sequentialSort(int * const a, const int arrSize) {
  • 35.
    if (useQsort) qSortArray(a,0, arrSize-1,"0"); else sSortArray (a,arrSize ,"0"); } /* ** If either of the array pointers are = 0, that array won't be ** sorted. However, in this program 2 arrays are always sorted ** but I did test the other option. */ void threadedSort ( int * const a1in, int * const a2in, const int arrSize ) { const sortParmType S1 = {a1in,arrSize,"1"}; const sortParmType S2 = {a2in,arrSize,"2"};
  • 36.
    pthread_t t1 =0; pthread_t t2 = 0; /* ** Set thread detatched attribute. */ // pthread_attr_t attr; // pthread_attr_init(&attr); // pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_JOINA BLE); if (a1in != 0) { const int rc = pthread_create(&t1,NULL,sortWrapper,(void *)(&S1)); if (rc) sThreadError(0); } if (a2in != 0)
  • 37.
    { const int rc= pthread_create(&t2,NULL,sortWrapper,(void *)(&S2)); if (rc) sThreadError(1); } joinThreads(t1,t2); // pthread_attr_destroy(&attr); } /* ** This function verifies that two arrays are equal and ** in ascending sorted order. Returns 1 if OK, otherwise 0. */ int verifyArrays ( const int * const a1in,
  • 38.
    const int *const a2in, const int arrSize ) { int i; const int u = arrSize-1; for (i=0; i<arrSize; ++i) { if (a1in[i] != a2in[i]) return 0; if ((i<u) && (a1in[i] > a1in[i+1])) return 0; } return 1; } /* ** This function outputs an array to stdout as long ** as DUMPINHIBIT is not equal to zero. */
  • 39.
    void dumpArray ( const char* const t, const int * const a, const int arrSize ) { if (DUMPINHIBIT) return; int i; printf("n"); printf(t); printf("n"); for (i=0; i<arrSize; printf(" %dn", a[i++])); } /* ** This function fills an array with values ** ranging from 0 to RAND_MAX. */
  • 40.
    void fillArray(int *const a, const int arrSize) { int i; for (i=0; i<arrSize; ++i) a[i] = rand(); } int main(const int argc, char * const argv[]) { /* ** Build the prompt so it will adjust if MAXARRAYSIZE ** is changed. */ char prompt[PROMPTSIZE]; sprintf ( prompt, "nEnter array size: 1 -- %d or anything else to quit >> ",
  • 41.
    MAXARRAYSIZE ); /* ** Constant usedin time computation */ const double mS_PER_CLOCK = mS_PER_SEC/CLOCKS_PER_SEC; /* ** If the user supplies any argument, use quicksort. */ if(argc>1) useQsort = 1; while(1) { const int as = getArraySize(prompt); const int as2 = as*2;
  • 42.
    clock_t t1,t2; /* ** Populatethe test arrays. Steps 1,2, and 3 */ fillArray(smallArray1,as); fillArray(smallArray2,as); copyArray(smallArray3,smallArray1,as); copyArray(smallArray4,smallArray2,as); copyArray(largeArray3,smallArray1,as); copyArray(&largeArray3[as],smallArray2,as); /* ** Run the first test case (2 sorts and a merge) Step 4 */ initBUF(); t1 = clock();
  • 43.
    threadedSort(smallArray1,smallArray2,as); mergeArrays(largeArray1,smallArray1,smallArray2,as2); t2 = clock(); cuBUF(); dumpArray("largeArray1:",largeArray1,as2); printf("Timeto do 2 thread sorts and a merge = %f", (double)(t2-t1) * mS_PER_CLOCK); printf(" microsecondsn"); return; /* ** Run the second test case (2 sorts, copy &merge) Step 5 */ t1 = clock(); sequentialSort(smallArray3,as); sequentialSort(smallArray4,as); mergeArrays(largeArray2,smallArray3,smallArray4,as2); t2 = clock(); dumpArray("largeArray2:",largeArray2,as2);
  • 44.
    printf("Time to do2 sequential sorts and a merge = %f", (double)(t2-t1) * mS_PER_CLOCK); printf(" microsecondsn"); /* ** Run the third test case (single sort) Step 6 */ t1 = clock(); sequentialSort(largeArray3,as2); t2 = clock(); dumpArray("largeArray3:",largeArray3,as2); printf("Time to do a sequential sort on a combined array = %f", (double)(t2-t1) * mS_PER_CLOCK); printf(" microsecondsn"); /* ** As a sanity check, ensure the arrays are
  • 45.
    ** equal andin sorted order. */ if((verifyArrays(largeArray1,largeArray2,as2) == 0) || (verifyArrays(largeArray1,largeArray3,as2) == 0)) printf("Error in sort algorithm!!!!n"); } cleanExit(); return 0; } #include <stdio.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include "sem.h" typedef struct sem_ds sDType; typedef struct seminfo sIType; typedef struct sembuf sBType;
  • 46.
    typedef union { int val; sDType*buf; const unsigned short int *array; sIType *__buf; } sUType; typedef struct { sUType arg; sBType zero; sBType lock; sBType unlock; long sID; pid_t pID; } iNType; static void setSB ( sBType * const s, const int sN, const int sO, const int sF ) { s->sem_num = sN; s->sem_op = sO; s->sem_flg = sF; } void initSEM (
  • 47.
    void * constv, const long k ) { const long kY = k; iNType *const iP = (iNType* const)v; sBType *const sZ = &iP->zero; sBType *const sL = &iP->lock; sBType *const sU = &iP->unlock; setSB (sZ,0,0,SEM_UNDO); setSB (sL,0,-1,SEM_UNDO); setSB (sU,0,1,SEM_UNDO); iP->pID = getpid(); iP->sID = semget(kY,1, IPC_CREAT| IPC_EXCL| 0666); if(iP->sID == -1) iP->sID = semget (kY,1,0); setSEM (0,v); } const int getSSizeSEM() { const int s = sizeof(iNType); return s;
  • 48.
    } const int pSEM ( void* const v ) { iNType *const iP = (iNType* const)v; const int sid = iP->sID; sBType *const sL = &iP->lock; const int eC = semop(sid, sL, 1); return eC; } const int setSEM ( const int x, void * const v ) { iNType *const iP = (iNType* const)v; const int sid = iP->sID; semctl (sid,0,SETVAL, x); } void vSEM (
  • 49.
    void * constv ) { iNType *const iP = (iNType* const)v; const int sid = iP->sID; sBType *const sU = &iP->unlock; semop (sid, sU, 1); } void zSEM ( void * const v ) { iNType *const iP = (iNType* const)v; const int sid = iP->sID; sBType *const sZ = &iP->zero; semop (sid, sZ, 1); } void dSEM ( void * const v ) { iNType *const iP = (iNType* const)v; const int p1 = getpid();
  • 50.
    const int p2= iP->pID; const long p3 = iP->sID; if(p1==p2) semctl(p3,0, IPC_RMID,0); } #include "shbuf.h" #include <stdio.h> int initBUF() {return 0;} // // Write to buffer. // int wBUF( const char * const s ) { printf(s); return 0; } // // Clean up. // int cuBUF() {return 0;}