Why PETSc/MPI uses only 1 processor a number of times, rather than using several as prescribed by mpiexec [closed]

I am a beginner to PETSc and MPI, so after installing PETSc I was compiling some basic tutorial. But whenever I give the number of processors i.e mpiexec -n 4 ./ex1 the first processor with 0th rank appears 4 times, and not the processor 2,3 and 4 even for a simple hello world program given in petsc/src/sys/examples/tutorials/ex1

What should I do?

This behavior typically results from using the wrong mpiexec. It has to be the one from the MPI that you used to install petsc. For instance, if you did --download-mpich during installation it's the one in \$PETSC_DIR/bin, not any other mpiexec that happens to be on your system.