The roof is olive green canvas, the inside gets stiflingly hot in the late afternoon, and when the thunderstorms roll in, Thomas Whitaker and his roommates have to scramble to get the flaps down. But all things considered, Whitaker likes being here a lot better than where he came from.

Thomas Whitaker is in prison, and the somewhat benign surroundings he enjoys mask the conditions inside Texas prisons that made these tents necessary. Without the tents, 3,000 inmates were forced to sleep on the floor in cells so overcrowded that one federal judge found that conditions violated the Constitution.

Texas is unusual in its solution, but the problem of overcrowding is a national crisis. Twenty-four states are under court order to relieve overcrowded conditions in their prisons, and in another 10 states, similar court challenges are pending.

Yesterday's decision by the Supreme Court, in which it ruled that double-celling by itself is not a violation of the Constitution, will give states some leeway in deciding how to eliminate overcrowding, but will not relieve the urgency of the problem.

Recent riots in Michigan and Hawaii, and memories of even worse uprisings last year in New Mexico, in which 33 persons were killed, testify to the horror of life inside America's prisons. Experts fear more violence.

"I hate to predict prison violence," said Norman A. Carlson, director of the federal Bureau of Prisons."But overcrowding tends to further exacerbate the tensions . . . that exist within an institution."

Anthony Travisono, executive director of the American Correctional Association, estimates that 85 percent of all prisons in this country are seriously overcrowded. "Every day that goes by we are setting a new record on institutiona population," he said.

Prison population has increased 63 percent in the past 10 years to 320,000, straining what Chief Justice Warren E. Burger has described as the "19th century penal institutions" that exist in this country.

Last December, Burger chastised the public for its failure to confront the problem. "To put people behind walls and bars and do little or nothing to change them is to win a battle but lose a war," he said. "It is wrong. It is expensive. It is stupid."

Last month, at George Washington University Law School, he warned again that "when society places a person behind walls and bars it has a moral obligation to take reasonable steps to try to work with that person and render him or her better equipped to return to a useful life as a member of society."

Instead, just the opposite has happened, as the public's hardening attitude toward crime has combined with high unemployment and a bulge in the age group most likely to be involved in criminal activity to swell prison populations far beyond capacity.

Many state legislatures have instituted mandatory sentences, judges have been tougher on criminals and some parole boards have reacted to the public mood by tightening up on releases.

"It all results in more people comming in at the front end and fewer coming out at the other end," said Alvin Bronstein of the American Civil Liberties Union's National Prisons Project.

Ron Tate of Alabama's Department of Corrections said, "The officer on the streets is doing his job, the prosecutor is doing his job and the judge is doing his. And we get left holding the bag."

Strained state budgets can hardly keep pace, even though increased prison funding is one area of exception to the fiscal cutbacks being made by state legislatures. In the past six years, 86 prisons have been built.

In many prisons, inmates are "stacked like rats," as one prison offical put it. Cells built for one prisoner hold as many as five, forcing many of them to sleep on the floor and increasing the potential for violence.

"It is impossible for a written opinion to convey the pernicious conditions and the pain and degradition which ordinary inmates suffer within Tdc [Texad Department of Corrections] walls," wrote U.S. District Court Judge William Wayne Justice last December.

Among Justice's findings were "the gruesome experiences of youthful first offenders forcibly raped; the cruel and justifiable fears of inmates, wondering when they will be called upon to defend the next violent assault; the sheer misery, the discomfort, the wholesale loss of privacy for prisoners housed with one, two, or three others in a 45-foot cell or suffocatingly packed together in a crowded dormitory; the physical suffering and wretched psychological stress which must be endured by those sick or injured who cannot obtain adequate medical care; the sense of abject helplessness felt by inmates arbitrarily sent to solitary confinement or administrative segregation without proper opportunity to defend themselves or to argue their causes; the bitter frustration of inmates prevented from petitioning the courts and other governmental authorities for relief from perceived injustices."

Justice ordered sweeping changes in prison operations here, including single-celling, a point that Attorney General Mark White had contested even before yesterday's Supreme Court ruling.

But Texas, like many other states, has plans to build new prisons as fast as it can, and unitl those new facilities are ready, prisoners will continue to use tents.

Even with new prisons, however, there is no guarantee that the problem of overcrowding, and the conditions that often accompany it, will be eliminated.

"States that have gone the construction route fill up in about two years," said Barry Krisberg, research director of the National Council on Crime and Delinquency. "It doesn't solve the problem."

Nor will increased capacity necessarily reduce crime. "There is almost no relationship between incarceration rates and crime rates," the ACLU's Bronstein said. "You could double the prison population tomorrow and you wouldn't impact the crime rate in New York or Washington or Houston by 1 percent."

Bronstein's comment is a warning to some demographers who believe that an aging U.S. population will result in less crime and the need for fewer prisons.

"Eighty years of history doesn't confirm that concept," Travisono said.

"If everything were equal, by 1990 the population might slow down a little bit. But everything isn't equal."

In fact, Travisono said, overcrowding is normal in a peacetime economy. "Any time we're in peacetime, our institutional populateion skyrockets."

States are experimenting with a variety of solutions to relieve the pressure. Texas will begin a work-furlough program this summer. Other states have given some prisoners early releases. Halfway houses and other community facilities are another alternative. But many states have no state-funded facilities of this kind.

But the experience of Alabama shows that there is no simple solution. Five years ago, Alabama was ordered to eliminate overcrowding in its state prisons. It did -- and today its county jails are bulging with state prisoners backed up in the system. And in New Mexico, five prisoners and a guard have been urdered since the state prison riots in February, 1980.